public abstract class Encoding extends Object
| Modifier and Type | Field and Description |
|---|---|
protected Log |
_log
Logger for the encoding subclass.
|
| Modifier | Constructor and Description |
|---|---|
protected |
Encoding()
Creates an Encoding with a logger.
|
| Modifier and Type | Method and Description |
|---|---|
Buffer |
decode(Buffer in)
Decode a buffer into another buffer.
|
void |
decode(Buffer in,
Buffer out)
Decode a buffer into another buffer using the input stream.
|
Buffer |
decode(byte[] in)
Decode a byte array using default offset and length.
|
Buffer |
decode(byte[] in,
int offset,
int length)
Decode a portion of a byte array.
|
abstract void |
decode(InputStream in,
Buffer out)
Decode an input stream into a buffer.
|
Buffer |
decode(String str)
Decode a string.
|
abstract String |
encode(byte[] in)
Encode a byte array to a ASCII or ISO-8859-1 String.
|
void |
encode(InputStream in,
Writer out)
Encode an input stream of bytes to a ASCII or ISO-8859-1 String.
|
String |
encode(String str)
Encode a (UTF-8) String to a ASCII or ISO-8859-1 String.
|
abstract String |
getName()
Returns the name of this encoding.
|
protected final Log _log
public Buffer decode(Buffer in) throws IOException
in - the buffer containing data to decodeDecodingException - if decoding failsIOExceptiondecode(byte[], int, int)public void decode(Buffer in, Buffer out) throws IOException
in - the buffer containing data to decodeout - the buffer to write decoded data toDecodingException - if decoding failsIOException - if reading from input stream failsdecode(byte[], int, int)public Buffer decode(byte[] in) throws DecodingException
in - the byte array to decodeDecodingException - if decoding failsdecode(byte[], int, int)public Buffer decode(byte[] in, int offset, int length) throws DecodingException
in - the byte array to decodeoffset - the starting position in the arraylength - the number of bytes to decodeDecodingException - if decoding failspublic abstract void decode(InputStream in, Buffer out) throws IOException
in - the input stream to read data fromout - the buffer to write decoded data toDecodingException - if decoding failsIOException - if reading from input stream failsdecode(byte[], int, int)public Buffer decode(String str) throws DecodingException
str - the string to decodeDecodingException - if decoding failsdecode(byte[], int, int)public abstract String encode(byte[] in) throws EncodingException
in - the byte array to encodeEncodingException - if encoding failspublic void encode(InputStream in, Writer out) throws IOException
in - the input stream to encodeout - the writer to write encoded output toIOException - if reading from stream or writing failspublic String encode(String str) throws EncodingException
str - the string to encodeEncodingException - if encoding failsencode(byte[])public abstract String getName()