Package com.ibm.icu.charset
Class CharsetBOCU1.CharsetEncoderBOCU
java.lang.Object
java.nio.charset.CharsetEncoder
com.ibm.icu.charset.CharsetEncoderICU
com.ibm.icu.charset.CharsetBOCU1.CharsetEncoderBOCU
- Enclosing class:
- CharsetBOCU1
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) int
(package private) boolean
(package private) CoderResult
(package private) int
private static final int
private static final int
private boolean
private int
(package private) boolean
(package private) int
(package private) int
private static final int
(package private) int
(package private) int
Fields inherited from class com.ibm.icu.charset.CharsetEncoderICU
errorBuffer, errorBufferLength, EXT_MAX_UCHARS, fromCharErrorBehaviour, fromUChar32, fromUContext, fromUnicodeStatus, invalidUCharBuffer, invalidUCharLength, MISSING_CHAR_MARKER, preFromUArray, preFromUBegin, preFromUFirstCP, preFromULength, useFallback, useSubChar1
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected CoderResult
encodeLoop
(CharBuffer source, ByteBuffer target, IntBuffer offsets, boolean flush) private int
fastSingle
(CharBuffer source, ByteBuffer target, IntBuffer offsets) private int
getTrail
(CharBuffer source, ByteBuffer target, IntBuffer offsets) private int
NEGDIVMOD
(int n, int d, int m) Integer division and modulo with negative numerators yields negative modulo results and quotients that are one more than what we need here.private int
packDiff
(int n) Encode a difference -0x10ffff..0x10ffff in 1..4 bytes and return a packed integer with them.private int
regularLoop
(CharBuffer source, ByteBuffer target, IntBuffer offsets) Methods inherited from class com.ibm.icu.charset.CharsetEncoderICU
cbFromUWriteSub, cbFromUWriteUChars, encode, encodeLoop, fromUCountPending, fromUnicodeWithCallback, fromUWriteBytes, getMaxBytesForString, handleSurrogates, handleSurrogates, implFlush, implOnMalformedInput, implOnUnmappableCharacter, implReset, isFallbackUsed, isFromUUseFallback, isFromUUseFallback, isLegalReplacement, maxCharsPerByte, setFallbackUsed, setFromUCallback, setFromUContext
Methods inherited from class java.nio.charset.CharsetEncoder
averageBytesPerChar, canEncode, canEncode, charset, encode, encode, flush, implReplaceWith, malformedInputAction, maxBytesPerChar, onMalformedInput, onUnmappableCharacter, replacement, replaceWith, reset, unmappableCharacterAction
-
Field Details
-
sourceIndex
int sourceIndex -
nextSourceIndex
int nextSourceIndex -
prev
int prev -
c
int c -
diff
int diff -
checkNegative
boolean checkNegative -
LoopAfterTrail
boolean LoopAfterTrail -
targetCapacity
int targetCapacity -
cr
CoderResult cr -
fastSingle
private static final int fastSingle- See Also:
-
getTrail
private static final int getTrail- See Also:
-
regularLoop
private static final int regularLoop- See Also:
-
LabelLoop
private boolean LabelLoop -
labelType
private int labelType
-
-
Constructor Details
-
CharsetEncoderBOCU
-
-
Method Details
-
NEGDIVMOD
private int NEGDIVMOD(int n, int d, int m) Integer division and modulo with negative numerators yields negative modulo results and quotients that are one more than what we need here. This macro adjust the results so that the modulo-value m is always >=0. For positive n, the if() condition is always false.- Parameters:
n
- Number to be split into quotient and rest. Will be modified to contain the quotient.d
- Divisor.m
- Output variable for the rest (modulo result).
-
packDiff
private int packDiff(int n) Encode a difference -0x10ffff..0x10ffff in 1..4 bytes and return a packed integer with them. The encoding favors small absolute differences with short encodings to compress runs of same-script characters. Optimized version with unrolled loops and fewer floating-point operations than the standard packDiff().- Parameters:
diff
- difference value -0x10ffff..0x10ffff- Returns:
- 0x010000zz for 1-byte sequence zz 0x0200yyzz for 2-byte sequence yy zz 0x03xxyyzz for 3-byte sequence xx yy zz 0xwwxxyyzz for 4-byte sequence ww xx yy zz (ww>0x03)
-
encodeLoop
protected CoderResult encodeLoop(CharBuffer source, ByteBuffer target, IntBuffer offsets, boolean flush) - Specified by:
encodeLoop
in classCharsetEncoderICU
-
fastSingle
-
getTrail
-
regularLoop
-