public abstract class CharsetEncoderICU
extends java.nio.charset.CharsetEncoder
Modifier and Type | Method and Description |
---|---|
protected java.nio.charset.CoderResult |
encodeLoop(java.nio.CharBuffer in,
java.nio.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 java.nio.charset.CoderResult |
implFlush(java.nio.ByteBuffer out)
Flushes any characters saved in the converter's internal buffer and
resets the converter.
|
protected void |
implOnMalformedInput(java.nio.charset.CodingErrorAction newAction)
Sets the action to be taken if an illegal sequence is encountered
|
protected void |
implOnUnmappableCharacter(java.nio.charset.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(java.nio.charset.CoderResult err,
CharsetCallback.Encoder newCallback,
java.lang.Object newContext)
Sets the callback encoder method and context to be used if an illegal sequence is encountered.
|
void |
setFromUContext(java.lang.Object newContext)
Sets fromUContext used in callbacks.
|
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(java.nio.charset.CodingErrorAction newAction)
implOnMalformedInput
in class java.nio.charset.CharsetEncoder
newAction
- action to be takenjava.lang.IllegalArgumentException
protected void implOnUnmappableCharacter(java.nio.charset.CodingErrorAction newAction)
implOnUnmappableCharacter
in class java.nio.charset.CharsetEncoder
newAction
- action to be takenjava.lang.IllegalArgumentException
public final void setFromUCallback(java.nio.charset.CoderResult err, CharsetCallback.Encoder newCallback, java.lang.Object newContext)
err
- CoderResultnewCallback
- CharsetCallback.EncodernewContext
- Objectpublic final void setFromUContext(java.lang.Object newContext)
newContext
- Objectjava.lang.IllegalArgumentException
- The object is an illegal argument for UContext.protected java.nio.charset.CoderResult implFlush(java.nio.ByteBuffer out)
implFlush
in class java.nio.charset.CharsetEncoder
out
- action to be takenprotected void implReset()
implReset
in class java.nio.charset.CharsetEncoder
protected java.nio.charset.CoderResult encodeLoop(java.nio.CharBuffer in, java.nio.ByteBuffer out)
encodeLoop
in class java.nio.charset.CharsetEncoder
in
- buffer to decodeout
- buffer to populate with decoded resultpublic boolean isLegalReplacement(byte[] repl)
isLegalReplacement
in class java.nio.charset.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 (c) 2013 IBM Corporation and others.