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
class CharsetBOCU1.CharsetEncoderBOCU extends CharsetEncoderICU
-
-
Field Summary
Fields Modifier and Type Field Description (package private) int
c
(package private) boolean
checkNegative
(package private) java.nio.charset.CoderResult
cr
(package private) int
diff
private static int
fastSingle
private static int
getTrail
private boolean
LabelLoop
private int
labelType
(package private) boolean
LoopAfterTrail
(package private) int
nextSourceIndex
(package private) int
prev
private static int
regularLoop
(package private) int
sourceIndex
(package private) int
targetCapacity
-
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 Constructor Description CharsetEncoderBOCU(CharsetICU cs)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.nio.charset.CoderResult
encodeLoop(java.nio.CharBuffer source, java.nio.ByteBuffer target, java.nio.IntBuffer offsets, boolean flush)
private int
fastSingle(java.nio.CharBuffer source, java.nio.ByteBuffer target, java.nio.IntBuffer offsets)
private int
getTrail(java.nio.CharBuffer source, java.nio.ByteBuffer target, java.nio.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(java.nio.CharBuffer source, java.nio.ByteBuffer target, java.nio.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
-
-
-
-
Field Detail
-
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
java.nio.charset.CoderResult cr
-
fastSingle
private static final int fastSingle
- See Also:
- Constant Field Values
-
getTrail
private static final int getTrail
- See Also:
- Constant Field Values
-
regularLoop
private static final int regularLoop
- See Also:
- Constant Field Values
-
LabelLoop
private boolean LabelLoop
-
labelType
private int labelType
-
-
Constructor Detail
-
CharsetEncoderBOCU
public CharsetEncoderBOCU(CharsetICU cs)
-
-
Method Detail
-
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 java.nio.charset.CoderResult encodeLoop(java.nio.CharBuffer source, java.nio.ByteBuffer target, java.nio.IntBuffer offsets, boolean flush)
- Specified by:
encodeLoop
in classCharsetEncoderICU
-
fastSingle
private int fastSingle(java.nio.CharBuffer source, java.nio.ByteBuffer target, java.nio.IntBuffer offsets)
-
getTrail
private int getTrail(java.nio.CharBuffer source, java.nio.ByteBuffer target, java.nio.IntBuffer offsets)
-
regularLoop
private int regularLoop(java.nio.CharBuffer source, java.nio.ByteBuffer target, java.nio.IntBuffer offsets)
-
-