public class

CharToByteUnicode

extends CharToByteConverter
java.lang.Object
   ↳ sun.io.CharToByteConverter
     ↳ sun.io.CharToByteUnicode
Known Direct Subclasses

Class Overview

Convert arrays containing Unicode characters into arrays of bytes, using the platform-default byte order.

Summary

Fields
protected int byteOrder
protected boolean usesMark
[Expand]
Inherited Fields
From class sun.io.CharToByteConverter
Public Constructors
CharToByteUnicode()
CharToByteUnicode(int byteOrder, boolean usesMark)
CharToByteUnicode(boolean usesMark)
Public Methods
int convert(char[] in, int inOff, int inEnd, byte[] out, int outOff, int outEnd)
Converts an array of Unicode characters into an array of bytes in the target character encoding.
int flush(byte[] in, int inOff, int inEnd)
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.
int getMaxBytesPerChar()
Returns the maximum number of bytes needed to convert a char.
void reset()
Resets converter to its initial state.
[Expand]
Inherited Methods
From class sun.io.CharToByteConverter
From class java.lang.Object

Fields

protected int byteOrder

protected boolean usesMark

Public Constructors

public CharToByteUnicode ()

public CharToByteUnicode (int byteOrder, boolean usesMark)

public CharToByteUnicode (boolean usesMark)

Public Methods

public int convert (char[] in, int inOff, int inEnd, byte[] out, int outOff, int outEnd)

Converts an array of Unicode characters into an array of bytes in the target character encoding. This method allows a buffer by buffer conversion of a data stream. The state of the conversion is saved between calls to convert. If a call to convert results in an exception, 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 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).
out 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.

public int flush (byte[] in, int inOff, int inEnd)

Writes any remaining output to the output buffer and resets the converter to its initial state.

Parameters
in byte array to receive flushed output.
inOff start writing to output array at this offset.
inEnd stop writing to output array at this offset (exclusive).

public String getCharacterEncoding ()

Returns the character set id for the conversion.

public int getMaxBytesPerChar ()

Returns the maximum number of bytes needed to convert a char. Useful for calculating the maximum output buffer size needed for a particular input buffer.

public void reset ()

Resets converter to its initial state.