|
IcedTea-Web NetX |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sourceforge.jnlp.tools.CharacterEncoder
public abstract class 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.
HexDumpEncoder
Field Summary | |
---|---|
protected java.io.PrintStream |
pStream
Stream that understands "printing" |
Constructor Summary | |
---|---|
CharacterEncoder()
|
Method Summary | |
---|---|
protected abstract int |
bytesPerAtom()
Return the number of bytes per atom of encoding |
protected abstract int |
bytesPerLine()
Return the number of bytes that can be encoded per line |
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. |
java.lang.String |
encode(java.nio.ByteBuffer aBuffer)
A 'streamless' version of encode that simply takes a ByteBuffer and returns a string containing the encoded buffer. |
void |
encode(java.nio.ByteBuffer aBuffer,
java.io.OutputStream aStream)
Encode the aBuffer ByteBuffer 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. |
protected abstract void |
encodeAtom(java.io.OutputStream aStream,
byte[] someBytes,
int anOffset,
int aLength)
Encode one "atom" of information into characters. |
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. |
java.lang.String |
encodeBuffer(java.nio.ByteBuffer aBuffer)
A 'streamless' version of encode that simply takes a ByteBuffer and returns a string containing the encoded buffer. |
void |
encodeBuffer(java.nio.ByteBuffer aBuffer,
java.io.OutputStream aStream)
Encode the aBuffer ByteBuffer 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 void |
encodeBufferPrefix(java.io.OutputStream aStream)
Encode the prefix for the entire buffer. |
protected void |
encodeBufferSuffix(java.io.OutputStream aStream)
Encode the suffix for the entire buffer. |
protected void |
encodeLinePrefix(java.io.OutputStream aStream,
int aLength)
Encode the prefix that starts every output line. |
protected void |
encodeLineSuffix(java.io.OutputStream aStream)
Encode the suffix that ends every output line. |
protected int |
readFully(java.io.InputStream in,
byte[] buffer)
This method works around the bizarre semantics of BufferedInputStream's read method. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.io.PrintStream pStream
Constructor Detail |
---|
public CharacterEncoder()
Method Detail |
---|
protected abstract int bytesPerAtom()
protected abstract int bytesPerLine()
protected void encodeBufferPrefix(java.io.OutputStream aStream) throws java.io.IOException
java.io.IOException
protected void encodeBufferSuffix(java.io.OutputStream aStream) throws java.io.IOException
java.io.IOException
protected void encodeLinePrefix(java.io.OutputStream aStream, int aLength) throws java.io.IOException
java.io.IOException
protected void encodeLineSuffix(java.io.OutputStream aStream) throws java.io.IOException
java.io.IOException
protected abstract void encodeAtom(java.io.OutputStream aStream, byte[] someBytes, int anOffset, int aLength) throws java.io.IOException
java.io.IOException
protected int readFully(java.io.InputStream in, byte[] buffer) throws java.io.IOException
java.io.IOException
public void encode(java.io.InputStream inStream, java.io.OutputStream outStream) throws java.io.IOException
java.io.IOException
public void encode(byte[] aBuffer, java.io.OutputStream aStream) throws java.io.IOException
java.io.IOException
public java.lang.String encode(byte[] aBuffer)
public void encode(java.nio.ByteBuffer aBuffer, java.io.OutputStream aStream) throws java.io.IOException
The ByteBuffer's position will be advanced to ByteBuffer's limit.
java.io.IOException
public java.lang.String encode(java.nio.ByteBuffer aBuffer)
The ByteBuffer's position will be advanced to ByteBuffer's limit.
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)
public void encodeBuffer(java.nio.ByteBuffer aBuffer, java.io.OutputStream aStream) throws java.io.IOException
The ByteBuffer's position will be advanced to ByteBuffer's limit.
java.io.IOException
public java.lang.String encodeBuffer(java.nio.ByteBuffer aBuffer)
The ByteBuffer's position will be advanced to ByteBuffer's limit.
|
IcedTea-Web NetX |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |