public abstract class CharsetEncoderICU extends CharsetEncoder
Modifier and Type | Method and Description |
---|---|
protected CoderResult |
encodeLoop(CharBuffer in,
ByteBuffer out)
Encodes one or more chars.
|
static int |
getMaxBytesForString(int length,
int maxCharSize)
Calculates the size of a buffer for conversion from Unicode to a charset.
|
protected CoderResult |
implFlush(ByteBuffer out)
Flushes any characters saved in the converter's internal buffer and
resets the converter.
|
protected void |
implOnMalformedInput(CodingErrorAction newAction)
Sets the action to be taken if an illegal sequence is encountered
|
protected void |
implOnUnmappableCharacter(CodingErrorAction newAction)
Sets the action to be taken if an illegal sequence is encountered
|
protected void |
implReset()
Resets the from Unicode mode of converter
|
boolean |
isFallbackUsed()
Is this Encoder allowed to use fallbacks?
|
boolean |
isLegalReplacement(byte[] repl)
Overrides super class method
|
float |
maxCharsPerByte()
Returns the maxCharsPerByte value for the Charset that created this encoder.
|
void |
setFallbackUsed(boolean usesFallback)
Sets whether this Encoder can use fallbacks?
|
void |
setFromUCallback(CoderResult err,
CharsetCallback.Encoder newCallback,
Object newContext)
Sets the callback encoder method and context to be used if an illegal sequence is encountered.
|
void |
setFromUContext(Object newContext)
Sets fromUContext used in callbacks.
|
averageBytesPerChar, canEncode, canEncode, charset, encode, encode, flush, implReplaceWith, malformedInputAction, maxBytesPerChar, onMalformedInput, onUnmappableCharacter, replacement, replaceWith, reset, unmappableCharacterAction
public boolean isFallbackUsed()
public void setFallbackUsed(boolean usesFallback)
usesFallback
- true if the user wants the converter to take
advantage of the fallback mapping, false otherwise.protected void implOnMalformedInput(CodingErrorAction newAction)
implOnMalformedInput
in class CharsetEncoder
newAction
- action to be takenIllegalArgumentException
protected void implOnUnmappableCharacter(CodingErrorAction newAction)
implOnUnmappableCharacter
in class CharsetEncoder
newAction
- action to be takenIllegalArgumentException
public final void setFromUCallback(CoderResult err, CharsetCallback.Encoder newCallback, Object newContext)
err
- CoderResultnewCallback
- CharsetCallback.EncodernewContext
- Objectpublic final void setFromUContext(Object newContext)
newContext
- ObjectIllegalArgumentException
- The object is an illegal argument for UContext.protected CoderResult implFlush(ByteBuffer out)
implFlush
in class CharsetEncoder
out
- action to be takenprotected void implReset()
implReset
in class CharsetEncoder
protected CoderResult encodeLoop(CharBuffer in, ByteBuffer out)
encodeLoop
in class CharsetEncoder
in
- buffer to decodeout
- buffer to populate with decoded resultpublic boolean isLegalReplacement(byte[] repl)
isLegalReplacement
in class CharsetEncoder
public final float maxCharsPerByte()
public static int getMaxBytesForString(int length, int maxCharSize)
length
- Number of chars to be converted.maxCharSize
- Return value from maxBytesPerChar for the converter
that will be used.Copyright © 2016 Unicode, Inc. and others.