All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class sun.io.ByteToCharUnicode

java.lang.Object
   |
   +----sun.io.ByteToCharConverter
           |
           +----sun.io.ByteToCharUnicode

public class ByteToCharUnicode
extends ByteToCharConverter
Convert byte arrays containing Unicode characters into arrays of actual Unicode characters, sensing the byte order automatically. To force a particular byte order, use either the "UnicodeBig" or the "UnicodeLittle" encoding.

This converter expects the first character converted to be a byte-order marker ('\\ufeff'), which it will interpret and discard. It will throw a MalformedInputException if the first character is not a marker, or if a marker that does not match the established byte order is later discovered. If a correct marker is seen later in the input stream, it is passed through as a character.

See Also:
ByteToCharUnicodeLittle, ByteToCharUnicodeBig

Constructor Index

 o ByteToCharUnicode()

Method Index

 o convert(byte[], int, int, char[], int, int)
Converts an array of bytes containing characters in an external encoding into an array of Unicode characters.
 o flush(char[], int, int)
Writes any remaining output to the output buffer and resets the converter to its initial state.
 o getCharacterEncoding()
Returns the character set id for the conversion
 o reset()
Resets converter to its initial state.

Constructors

 o ByteToCharUnicode
 public ByteToCharUnicode()

Methods

 o getCharacterEncoding
 public String getCharacterEncoding()
Returns the character set id for the conversion

Overrides:
getCharacterEncoding in class ByteToCharConverter
 o convert
 public int convert(byte in[],
                    int inOff,
                    int inEnd,
                    char out[],
                    int outOff,
                    int outEnd) throws ConversionBufferFullException, MalformedInputException
Converts an array of bytes containing characters in an external encoding into an array of Unicode characters.

Overrides:
convert in class ByteToCharConverter
 o reset
 public void reset()
Resets converter to its initial state.

Overrides:
reset in class ByteToCharConverter
 o flush
 public int flush(char buf[],
                  int off,
                  int len) throws MalformedInputException
Writes any remaining output to the output buffer and resets the converter to its initial state.

Overrides:
flush in class ByteToCharConverter

All Packages  Class Hierarchy  This Package  Previous  Next  Index