|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectsun.io.ByteToCharConverter
sun.io.ByteToCharUnicode
public class ByteToCharUnicode
Convert byte arrays containing Unicode characters into arrays of actual Unicode characters. This class may be used directly, in which case it expects the input byte array to begin with a byte-order mark, or it may be subclassed in order to preset the byte order and mark behavior.
Whether or not a mark is expected, if a mark that does not match the established byte order is later discovered then a MalformedInputException will be thrown by the convert method. If a correct mark is seen later in the input stream, it is passed through as a character.
ByteToCharUnicodeLittle,
ByteToCharUnicodeLittleUnmarked,
ByteToCharUnicodeBig,
ByteToCharUnicodeBigUnmarked| Field Summary |
|---|
| Fields inherited from class sun.io.ByteToCharConverter |
|---|
badInputLength, byteOff, charOff, subChars, subMode |
| Constructor Summary | |
|---|---|
|
ByteToCharUnicode()
Creates a Unicode byte-to-char converter that expects the first pair of input bytes to be a byte-order mark, which will be interpreted and discarded. |
protected |
ByteToCharUnicode(int bo,
boolean m)
Creates a Unicode byte-to-char converter that uses the given byte order and may or may not insist upon an initial byte-order mark. |
| Method Summary | |
|---|---|
int |
convert(byte[] in,
int inOff,
int inEnd,
char[] out,
int outOff,
int outEnd)
Converts an array of bytes containing characters in an external encoding into an array of Unicode characters. |
int |
flush(char[] buf,
int off,
int len)
Writes any remaining output to the output buffer and resets the converter to its initial state. |
String |
getCharacterEncoding()
Returns the character set id for the conversion |
void |
reset()
Resets converter to its initial state. |
| Methods inherited from class sun.io.ByteToCharConverter |
|---|
convertAll, getBadInputLength, getConverter, getDefault, getMaxCharsPerByte, nextByteIndex, nextCharIndex, setSubstitutionChars, setSubstitutionMode, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public ByteToCharUnicode()
protected ByteToCharUnicode(int bo,
boolean m)
| Method Detail |
|---|
public String getCharacterEncoding()
ByteToCharConverter
getCharacterEncoding in class ByteToCharConverter
public int convert(byte[] in,
int inOff,
int inEnd,
char[] out,
int outOff,
int outEnd)
throws ConversionBufferFullException,
MalformedInputException
ByteToCharConverter
convert in class ByteToCharConverterin - byte array containing text to be converted.inOff - begin conversion at this offset in input array.inEnd - stop conversion at this offset in input array (exclusive).out - character array to receive conversion result.outOff - start writing to output array at this offset.outEnd - stop writing to output array at this offset (exclusive).
ConversionBufferFullException - if output array is filled prior
to converting all the input.
MalformedInputException - if the input buffer contains any
sequence of bytes that is illegal for the input character set.public void reset()
ByteToCharConverter
reset in class ByteToCharConverter
public int flush(char[] buf,
int off,
int len)
throws MalformedInputException
ByteToCharConverter
flush in class ByteToCharConverterbuf - char array to receive flushed output.off - start writing to output array at this offset.len - stop writing to output array at this offset (exclusive).
MalformedInputException - if the output to be flushed contained
a partial or invalid multibyte character sequence. 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.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||