public interface TextCodec extends Copyable
Modifier and Type | Method and Description |
---|---|
void |
closeCodec()
This aborts any on-going processing and frees resources associated with the codec.
|
CharArray |
decodeText(byte[] encodedText,
int start,
int length,
boolean endOfData,
CharArray destination)
Decode the bytes into Unicode characters.
|
ByteArray |
encodeText(char[] text,
int start,
int length,
boolean endOfData,
ByteArray destination)
Enocde the Unicode characters into a byte Stream.
|
Object |
getCopy()
This should return a new instance of the TextCodec, ready to begin converting a new set of
data.
|
void |
reset()
Reset the codec for both input and output.
|
void reset()
ByteArray encodeText(char[] text, int start, int length, boolean endOfData, ByteArray destination) throws IOException
text
- The characters to encode. This can be null if length is zero and endOfData is true. You
would use those settings to tell the codec that no more characters are to be encoded and
the final set of output bytes (if any) should be output.start
- The start of the characters in the text array.length
- The number of characters to encode.endOfData
- If this is true this tells the codec that no more characters are to be
encoded and the final set of output bytes (if any) should be output.destination
- A ByteArray to hold the output data. The output data is appended to the data member and
and the length member holds how many bytes were output.IOException
- if an error occurs during encoding.CharArray decodeText(byte[] encodedText, int start, int length, boolean endOfData, CharArray destination) throws IOException
encodedText
- The encoded bytes. This can be null if length is zero and endOfData is true. You
would use those settings to tell the codec that no more characters are to be decoded and
the final set of decoded characters (if any) should be output.start
- The start of the bytes in the byte array.length
- The number of bytes to decode.endOfData
- If this is true this tells the codec that no more characters are to be decoded and
the final set of decoded characters (if any) should be output.destination
- A CharArray to hold the output data. The output data is appended to the data member and
and the length member will be updated to indicate how many bytes were appended.IOException
- if an error occurs during decoding, including badly formatted data.void closeCodec() throws IOException
IOException