com.ibm.icu.charset
Class CharsetEncoderICU

java.lang.Object
  extended by java.nio.charset.CharsetEncoder
      extended by com.ibm.icu.charset.CharsetEncoderICU

public abstract class CharsetEncoderICU
extends java.nio.charset.CharsetEncoder

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 sematics of ICU4C.

Status:
Draft ICU 3.6.

Method Summary
protected  java.nio.charset.CoderResult encodeLoop(java.nio.CharBuffer in, java.nio.ByteBuffer out)
          Encodes one or more chars.
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
 void setFallbackUsed(boolean usesFallback)
          Sets whether this Encoder can use fallbacks?
 
Methods inherited from class java.nio.charset.CharsetEncoder
averageBytesPerChar, canEncode, canEncode, charset, encode, encode, flush, implReplaceWith, malformedInputAction, maxBytesPerChar, onMalformedInput, onUnmappableCharacter, replacement, replaceWith, reset, unmappableCharacterAction
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

isFallbackUsed

public boolean isFallbackUsed()
Is this Encoder allowed to use fallbacks? A fallback mapping is a mapping that will convert a Unicode codepoint sequence to a byte sequence, but the encoded byte sequence will round trip convert to a different Unicode codepoint sequence.

Returns:
true if the converter uses fallback, false otherwise.
Status:
Draft ICU 3.8.

setFallbackUsed

public void setFallbackUsed(boolean usesFallback)
Sets whether this Encoder can use fallbacks?

Parameters:
usesFallback - true if the user wants the converter to take advantage of the fallback mapping, false otherwise.
Status:
Draft ICU 3.8.

implOnMalformedInput

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

Overrides:
implOnMalformedInput in class java.nio.charset.CharsetEncoder
Parameters:
newAction - action to be taken
Throws:
java.lang.IllegalArgumentException
Status:
Stable ICU 3.6.

implOnUnmappableCharacter

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

Overrides:
implOnUnmappableCharacter in class java.nio.charset.CharsetEncoder
Parameters:
newAction - action to be taken
Throws:
java.lang.IllegalArgumentException
Status:
Stable ICU 3.6.

implFlush

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

Overrides:
implFlush in class java.nio.charset.CharsetEncoder
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 from Unicode mode of converter

Overrides:
implReset in class java.nio.charset.CharsetEncoder
Status:
Stable ICU 3.6.

encodeLoop

protected java.nio.charset.CoderResult encodeLoop(java.nio.CharBuffer in,
                                                  java.nio.ByteBuffer out)
Encodes one or more chars. The default behaviour of the converter is stop and report if an error in input stream is encountered. To set different behaviour use @see CharsetEncoder.onMalformedInput()

Specified by:
encodeLoop in class java.nio.charset.CharsetEncoder
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 3.6.

isLegalReplacement

public boolean isLegalReplacement(byte[] repl)
Overrides super class method

Overrides:
isLegalReplacement in class java.nio.charset.CharsetEncoder
Status:
Stable ICU 3.6.


Copyright (c) 2007 IBM Corporation and others.