public abstract class CharacterEncoder
extends java.lang.Object
[Buffer Prefix] [Line Prefix][encoded data atoms][Line Suffix] [Buffer Suffix]In the CharacterEncoder and CharacterDecoder classes, one complete chunk of data is referred to as a buffer. Encoded buffers are all text, and decoded buffers (sometimes just referred to as buffers) are binary octets. To create a custom encoder, you must, at a minimum, overide three abstract methods in this class.
CharacterDecoder;
, BASE64Encoder
Modifier and Type | Field and Description |
---|---|
protected java.io.PrintStream |
pStream
Stream that understands "printing"
|
Constructor and Description |
---|
CharacterEncoder() |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
encodeBuffer(byte[] aBuffer)
A 'streamless' version of encode that simply takes a buffer of bytes and returns a string containing the encoded buffer.
|
void |
encodeBuffer(byte[] aBuffer, java.io.OutputStream aStream)
Encode the buffer in aBuffer and write the encoded result to the OutputStream aStream.
|
void |
encodeBuffer(java.io.InputStream inStream, java.io.OutputStream outStream)
Encode bytes from the input stream, and write them as text characters to the output stream.
|
protected int |
readFully(java.io.InputStream in, byte[] buffer)
This method works around the bizarre semantics of BufferedInputStream's read method.
|
protected int readFully(java.io.InputStream in, byte[] buffer) throws java.io.IOException
java.io.IOException
public void encodeBuffer(java.io.InputStream inStream, java.io.OutputStream outStream) throws java.io.IOException
java.io.IOException
public void encodeBuffer(byte[] aBuffer, java.io.OutputStream aStream) throws java.io.IOException
java.io.IOException
public java.lang.String encodeBuffer(byte[] aBuffer)