com.ibm.icu4jni.charset
Class CharsetDecoderICU

java.lang.Object
  extended byjava.nio.charset.CharsetDecoder
      extended bycom.ibm.icu4jni.charset.CharsetDecoderICU

public final class CharsetDecoderICU
extends java.nio.charset.CharsetDecoder


Constructor Summary
CharsetDecoderICU(java.nio.charset.Charset cs, long cHandle)
          Constructs a new decoder for the given charset
 
Method Summary
protected  java.nio.charset.CoderResult decodeLoop(java.nio.ByteBuffer in, java.nio.CharBuffer out)
          Decodes one or more bytes.
protected  void finalize()
          Releases the system resources by cleanly closing ICU converter opened
protected  java.nio.charset.CoderResult implFlush(java.nio.CharBuffer 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 implReplaceWith(java.lang.String newReplacement)
          Sets this decoders replacement string.
protected  void implReset()
          Resets the to Unicode mode of converter
 
Methods inherited from class java.nio.charset.CharsetDecoder
averageCharsPerByte, charset, decode, decode, detectedCharset, flush, isAutoDetecting, isCharsetDetected, malformedInputAction, maxCharsPerByte, onMalformedInput, onUnmappableCharacter, replacement, replaceWith, reset, unmappableCharacterAction
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CharsetDecoderICU

public CharsetDecoderICU(java.nio.charset.Charset cs,
                         long cHandle)
Constructs a new decoder for the given charset

Parameters:
cs - for which the decoder is created
cHandle - the address of ICU converter
Throws:
java.lang.RuntimeException
Status:
Stable ICU 2.4.
Method Detail

implReplaceWith

protected void implReplaceWith(java.lang.String newReplacement)
Sets this decoders replacement string. Substitutes the string in input if an umappable or illegal sequence is encountered

Parameters:
newReplacement - to replace the error bytes with
Status:
Stable ICU 2.4.

implOnMalformedInput

protected final void implOnMalformedInput(java.nio.charset.CodingErrorAction newAction)
Sets the action to be taken if an illegal sequence is encountered

Parameters:
newAction - action to be taken
Throws:
java.lang.IllegalArgumentException
Status:
Stable ICU 2.4.

implOnUnmappableCharacter

protected final void implOnUnmappableCharacter(java.nio.charset.CodingErrorAction newAction)
Sets the action to be taken if an illegal sequence is encountered

Parameters:
newAction - action to be taken
Throws:
java.lang.IllegalArgumentException
Status:
Stable ICU 2.4.

implFlush

protected final java.nio.charset.CoderResult implFlush(java.nio.CharBuffer out)
Flushes any characters saved in the converter's internal buffer and resets the converter.

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 2.4.

implReset

protected void implReset()
Resets the to Unicode mode of converter

Status:
Stable ICU 2.4.

decodeLoop

protected java.nio.charset.CoderResult decodeLoop(java.nio.ByteBuffer in,
                                                  java.nio.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.

Parameters:
in - buffer to decode
out - 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 2.4.

finalize

protected void finalize()
                 throws java.lang.Throwable
Releases the system resources by cleanly closing ICU converter opened

Throws:
java.lang.Throwable
Status:
Stable ICU 2.4.