com.novell.io
Class UTF16Encoder

java.lang.Object
  extended bycom.novell.io.CharEncoder
      extended bycom.novell.io.UTF16Encoder

public class UTF16Encoder
extends CharEncoder

This class implements little-endian UTF-16 encoding for use by the EncodingStreamWriter class


Field Summary
static String NAME
          Name of encoding that this encoder implements.
 
Constructor Summary
UTF16Encoder()
           
 
Method Summary
 int encodeChar(int c, byte[] buffer, int off)
          Implementation of UTF-16 character encoding
 String getEncoding()
          Return the string identifier for this encoding scheme.
 void reset()
          Call to reset the encoder before outputting a new stream
 
Methods inherited from class com.novell.io.CharEncoder
doGetClass, encodeChars, getEncoder, registerEncoder
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NAME

public static final String NAME
Name of encoding that this encoder implements.

See Also:
Constant Field Values
Constructor Detail

UTF16Encoder

public UTF16Encoder()
Method Detail

reset

public void reset()
Call to reset the encoder before outputting a new stream

Overrides:
reset in class CharEncoder

encodeChar

public int encodeChar(int c,
                      byte[] buffer,
                      int off)
               throws CharEncodingException,
                      EncodingBufferFullException
Implementation of UTF-16 character encoding

Specified by:
encodeChar in class CharEncoder
Parameters:
c - The 32-bit character value to encode
buffer - The byte buffer in which to placed encoded bytes
off - The offset at which to place bytes into the buffer
Returns:
The number of bytes placed in the buffer
Throws:
CharEncodingException - The character could not be encoded in the implemented encoding scheme.
EncodingBufferFullException - There is not enough room in buffer for all the bytes needed to encode the character.

getEncoding

public String getEncoding()
Return the string identifier for this encoding scheme.

Specified by:
getEncoding in class CharEncoder
Returns:
The string identifier for this encoding scheme.