sun.io
Class CharToByteEUC_TW

java.lang.Object
  extended by sun.io.CharToByteConverter
      extended by sun.io.CharToByteEUC_TW

public class CharToByteEUC_TW
extends CharToByteConverter


Field Summary
protected  String cnsTab1
           
protected  String cnsTab2
           
protected  String uniTab1
          Unicode table
protected  String uniTab2
           
 
Fields inherited from class sun.io.CharToByteConverter
badInputLength, byteOff, charOff, subBytes, subMode
 
Constructor Summary
CharToByteEUC_TW()
           
 
Method Summary
 boolean canConvert(char ch)
          Returns true if the given character can be converted to the target character encoding.
 int convert(char[] input, int inOff, int inEnd, byte[] output, int outOff, int outEnd)
          Character conversion
 int flush(byte[] output, int outStart, int outEnd)
          Writes any remaining output to the output buffer and resets the converter to its initial state.
 String getCharacterEncoding()
          Return the character set ID
 int getMaxBytesPerChar()
          returns the maximum number of bytes needed to convert a char
protected  int getNative(char unicode)
           
 void reset()
          Resets converter to its initial state.
protected  int searchTab(char code, char[] table)
           
 
Methods inherited from class sun.io.CharToByteConverter
convertAll, convertAny, flushAny, getBadInputLength, getConverter, getDefault, nextByteIndex, nextCharIndex, setSubstitutionBytes, setSubstitutionMode, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

uniTab1

protected final String uniTab1
Unicode table

See Also:
Constant Field Values

uniTab2

protected final String uniTab2
See Also:
Constant Field Values

cnsTab1

protected final String cnsTab1
See Also:
Constant Field Values

cnsTab2

protected final String cnsTab2
See Also:
Constant Field Values
Constructor Detail

CharToByteEUC_TW

public CharToByteEUC_TW()
Method Detail

flush

public int flush(byte[] output,
                 int outStart,
                 int outEnd)
          throws MalformedInputException
Description copied from class: CharToByteConverter
Writes any remaining output to the output buffer and resets the converter to its initial state.

Specified by:
flush in class CharToByteConverter
Parameters:
output - byte array to receive flushed output.
outStart - start writing to output array at this offset.
outEnd - stop writing to output array at this offset (exclusive).
Throws:
MalformedInputException - if the output to be flushed contained a partial or invalid multibyte character sequence. Will occur if the input buffer on the last call to convert ended with the first character of a surrogate pair. flush will write what it can to the output buffer and reset the converter before throwing this exception. An additional call to flush is not required.

reset

public void reset()
Description copied from class: CharToByteConverter
Resets converter to its initial state.

Specified by:
reset in class CharToByteConverter

canConvert

public boolean canConvert(char ch)
Description copied from class: CharToByteConverter
Returns true if the given character can be converted to the target character encoding.

Overrides:
canConvert in class CharToByteConverter
Parameters:
ch - character to test
Returns:
true if given character is translatable, false otherwise.

convert

public int convert(char[] input,
                   int inOff,
                   int inEnd,
                   byte[] output,
                   int outOff,
                   int outEnd)
            throws UnknownCharacterException,
                   MalformedInputException,
                   ConversionBufferFullException
Character conversion

Specified by:
convert in class CharToByteConverter
Parameters:
input - array containing Unicode characters to be converted.
inOff - begin conversion at this offset in input array.
inEnd - stop conversion at this offset in input array (exclusive).
output - byte array to receive conversion result.
outOff - start writing to output array at this offset.
outEnd - stop writing to output array at this offset (exclusive).
Returns:
the number of bytes written to output.
Throws:
UnknownCharacterException - for any character that that cannot be converted to the external character encoding. Thrown only when converter is not in substitution mode.
MalformedInputException - if the input buffer contains any sequence of chars that is illegal in Unicode (principally unpaired surrogates and ? or ?). After this exception is thrown, the method nextCharIndex can be called to obtain the index of the first invalid input character. The MalformedInputException can be queried for the length of the invalid input.
ConversionBufferFullException - if output array is filled prior to converting all the input.

getMaxBytesPerChar

public int getMaxBytesPerChar()
returns the maximum number of bytes needed to convert a char

Specified by:
getMaxBytesPerChar in class CharToByteConverter

getCharacterEncoding

public String getCharacterEncoding()
Return the character set ID

Specified by:
getCharacterEncoding in class CharToByteConverter

getNative

protected int getNative(char unicode)

searchTab

protected int searchTab(char code,
                        char[] table)