java.lang.Object | |
↳ | sun.misc.CharacterEncoder |
![]() |
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.
UCEncoder
UUEncoder
BASE64Encoder
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
pStream | Stream that understands "printing" |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Encode the buffer in aBuffer and write the encoded
result to the OutputStream aStream.
| |||||||||||
A 'streamless' version of encode that simply takes a ByteBuffer
and returns a string containing the encoded buffer.
| |||||||||||
Encode bytes from the input stream, and write them as text characters
to the output stream.
| |||||||||||
A 'streamless' version of encode that simply takes a buffer of
bytes and returns a string containing the encoded buffer.
| |||||||||||
Encode the aBuffer ByteBuffer and write the encoded
result to the OutputStream aStream.
| |||||||||||
Encode the buffer in aBuffer and write the encoded
result to the OutputStream aStream.
| |||||||||||
A 'streamless' version of encode that simply takes a ByteBuffer
and returns a string containing the encoded buffer.
| |||||||||||
Encode bytes from the input stream, and write them as text characters
to the output stream.
| |||||||||||
Encode the aBuffer ByteBuffer and write the encoded
result to the OutputStream aStream.
| |||||||||||
A 'streamless' version of encode that simply takes a buffer of
bytes and returns a string containing the encoded buffer.
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Return the number of bytes per atom of encoding
| |||||||||||
Return the number of bytes that can be encoded per line
| |||||||||||
Encode one "atom" of information into characters.
| |||||||||||
Encode the prefix for the entire buffer.
| |||||||||||
Encode the suffix for the entire buffer.
| |||||||||||
Encode the prefix that starts every output line.
| |||||||||||
Encode the suffix that ends every output line.
| |||||||||||
This method works around the bizarre semantics of BufferedInputStream's
read method.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
Encode the buffer in aBuffer and write the encoded result to the OutputStream aStream.
IOException |
---|
A 'streamless' version of encode that simply takes a ByteBuffer and returns a string containing the encoded buffer.
The ByteBuffer's position will be advanced to ByteBuffer's limit.
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().
IOException |
---|
A 'streamless' version of encode that simply takes a buffer of bytes and returns a string containing the encoded buffer.
Encode the aBuffer ByteBuffer and write the encoded result to the OutputStream aStream.
The ByteBuffer's position will be advanced to ByteBuffer's limit.
IOException |
---|
Encode the buffer in aBuffer and write the encoded result to the OutputStream aStream.
IOException |
---|
A 'streamless' version of encode that simply takes a ByteBuffer and returns a string containing the encoded buffer.
The ByteBuffer's position will be advanced to ByteBuffer's limit.
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().
IOException |
---|
Encode the aBuffer ByteBuffer and write the encoded result to the OutputStream aStream.
The ByteBuffer's position will be advanced to ByteBuffer's limit.
IOException |
---|
A 'streamless' version of encode that simply takes a buffer of bytes and returns a string containing the encoded buffer.
Return the number of bytes per atom of encoding
Return the number of bytes that can be encoded per line
Encode one "atom" of information into characters.
IOException |
---|
Encode the prefix for the entire buffer. By default is simply opens the PrintStream for use by the other functions.
IOException |
---|
Encode the suffix for the entire buffer.
IOException |
---|
Encode the prefix that starts every output line.
IOException |
---|
Encode the suffix that ends every output line. By default
this method just prints a
IOException |
---|
This method works around the bizarre semantics of BufferedInputStream's read method.
IOException |
---|