com.ibm.net.ssl.internal.www.protocol.https
Class CharacterEncoder
java.lang.Object
|
+--com.ibm.net.ssl.internal.www.protocol.https.CharacterEncoder
- Direct Known Subclasses:
- BASE64Encoder
- public abstract class CharacterEncoder
- extends java.lang.Object
This class defines the encoding half of character encoders.
A character encoder is an algorithim for transforming 8 bit binary
data into text (generally 7 bit ASCII or 8 bit ISO-Latin-1 text)
for transmition over text channels such as e-mail and network news.
The character encoders have been structured around a central theme
that, in general, the encoded text has the form:
[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.
- bytesPerAtom which tells the encoder how many bytes to
send to encodeAtom
- encodeAtom which encodes the bytes sent to it as text.
- bytesPerLine which tells the encoder the maximum number of
bytes per line.
Several useful encoders have already been written and are
referenced in the See Also list below.
- Version:
- 1.28, 00/02/24
- Author:
- Chuck McManis
- See Also:
- ,
UCEncoder
,
UUEncoder
,
BASE64Encoder
Method Summary |
java.lang.String |
encode(byte[] aBuffer)
A 'streamless' version of encode that simply takes a buffer of
bytes and returns a string containing the encoded buffer. |
void |
encode(byte[] aBuffer,
java.io.OutputStream aStream)
Encode the buffer in aBuffer and write the encoded
result to the OutputStream aStream. |
void |
encode(java.io.InputStream inStream,
java.io.OutputStream outStream)
Encode bytes from the input stream, and write them as text characters
to the output stream. |
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. |
Methods inherited from class java.lang.Object |
equals,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
CharacterEncoder
public CharacterEncoder()
encode
public void encode(java.io.InputStream inStream,
java.io.OutputStream outStream)
throws java.io.IOException
- Encode bytes from the input stream, and write them as text characters
to the output stream. This method will run until it exhausts the
input stream, but does not print the line suffix for a final
line that is shorter than bytesPerLine().
encode
public void encode(byte[] aBuffer,
java.io.OutputStream aStream)
throws java.io.IOException
- Encode the buffer in aBuffer and write the encoded
result to the OutputStream aStream.
encode
public java.lang.String encode(byte[] aBuffer)
- A 'streamless' version of encode that simply takes a buffer of
bytes and returns a string containing the encoded buffer.
encodeBuffer
public void encodeBuffer(java.io.InputStream inStream,
java.io.OutputStream outStream)
throws java.io.IOException
- Encode bytes from the input stream, and write them as text characters
to the output stream. This method will run until it exhausts the
input stream. It differs from encode in that it will add the
line at the end of a final line that is shorter than bytesPerLine().
encodeBuffer
public void encodeBuffer(byte[] aBuffer,
java.io.OutputStream aStream)
throws java.io.IOException
- Encode the buffer in aBuffer and write the encoded
result to the OutputStream aStream.
encodeBuffer
public 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.