Package com.ibm.icu.charset
Class CharsetDecoderICU
- java.lang.Object
-
- java.nio.charset.CharsetDecoder
-
- com.ibm.icu.charset.CharsetDecoderICU
-
public abstract class CharsetDecoderICU extends CharsetDecoder
An abstract class that provides framework methods of decoding operations for concrete subclasses. In the future this class will contain API that will implement converter semantics of ICU4C.- Status:
- Stable ICU 3.6.
-
-
Field Summary
Fields Modifier and Type Field Description protected static intEXT_MAX_BYTESDeprecated.This API is ICU internal only.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected CoderResultdecodeLoop(ByteBuffer in, CharBuffer out)Decodes one or more bytes.protected CoderResultimplFlush(CharBuffer out)Flushes any characters saved in the converter's internal buffer and resets the converter.protected voidimplOnMalformedInput(CodingErrorAction newAction)Sets the action to be taken if an illegal sequence is encounteredprotected voidimplOnUnmappableCharacter(CodingErrorAction newAction)Sets the action to be taken if an illegal sequence is encounteredprotected voidimplReset()Resets the to Unicode mode of converterfloatmaxBytesPerChar()Returns the maxBytesPerChar value for the Charset that created this decoder.voidsetToUCallback(CoderResult err, CharsetCallback.Decoder newCallback, Object newContext)Sets the callback encoder method and context to be used if an illegal sequence is encountered.-
Methods inherited from class java.nio.charset.CharsetDecoder
averageCharsPerByte, charset, decode, decode, detectedCharset, flush, implReplaceWith, isAutoDetecting, isCharsetDetected, malformedInputAction, maxCharsPerByte, onMalformedInput, onUnmappableCharacter, replacement, replaceWith, reset, unmappableCharacterAction
-
-
-
-
Field Detail
-
EXT_MAX_BYTES
@Deprecated protected static final int EXT_MAX_BYTES
Deprecated.This API is ICU internal only.Maximum number of indexed bytes- See Also:
- Constant Field Values
- Status:
- Internal. This API is ICU internal only.
-
-
Method Detail
-
implOnMalformedInput
protected final void implOnMalformedInput(CodingErrorAction newAction)
Sets the action to be taken if an illegal sequence is encountered- Overrides:
implOnMalformedInputin classCharsetDecoder- Parameters:
newAction- action to be taken- Throws:
IllegalArgumentException- Status:
- Stable ICU 3.6.
-
implOnUnmappableCharacter
protected final void implOnUnmappableCharacter(CodingErrorAction newAction)
Sets the action to be taken if an illegal sequence is encountered- Overrides:
implOnUnmappableCharacterin classCharsetDecoder- Parameters:
newAction- action to be taken- Throws:
IllegalArgumentException- Status:
- Stable ICU 3.6.
-
setToUCallback
public final void setToUCallback(CoderResult err, CharsetCallback.Decoder newCallback, Object newContext)
Sets the callback encoder method and context to be used if an illegal sequence is encountered. You would normally call this twice to set both the malform and unmappable error. In this case, newContext should remain the same since using a different newContext each time will negate the last one used.- Parameters:
err- CoderResultnewCallback- CharsetCallback.EncodernewContext- Object- Status:
- Stable ICU 4.0.
-
implFlush
protected final CoderResult implFlush(CharBuffer out)
Flushes any characters saved in the converter's internal buffer and resets the converter.- Overrides:
implFlushin classCharsetDecoder- Parameters:
out- action to be taken- Returns:
- result of flushing action and completes the decoding all input. Returns CoderResult.UNDERFLOW if the action succeeds.
- Status:
- Stable ICU 3.6.
-
implReset
protected void implReset()
Resets the to Unicode mode of converter- Overrides:
implResetin classCharsetDecoder- Status:
- Stable ICU 3.6.
-
decodeLoop
protected CoderResult decodeLoop(ByteBuffer in, CharBuffer out)
Decodes one or more bytes. The default behaviour of the converter is stop and report if an error in input stream is encountered. To set different behaviour use @see CharsetDecoder.onMalformedInput() This method allows a buffer by buffer conversion of a data stream. The state of the conversion is saved between calls to convert. Among other things, this means multibyte input sequences can be split between calls. If a call to convert results in an Error, the conversion may be continued by calling convert again with suitably modified parameters.All conversions should be finished with a call to the flush method.- Specified by:
decodeLoopin classCharsetDecoder- Parameters:
in- buffer to decodeout- buffer to populate with decoded result- Returns:
- Result of decoding action. Returns CoderResult.UNDERFLOW if the decoding action succeeds or more input is needed for completing the decoding action.
- Status:
- Stable ICU 3.6.
-
maxBytesPerChar
public final float maxBytesPerChar()
Returns the maxBytesPerChar value for the Charset that created this decoder.- Returns:
- maxBytesPerChar
- Status:
- Stable ICU 4.8.
-
-