public abstract class CharacterDecoder extends Object
47 * [Buffer Prefix]
48 * [Line Prefix][encoded data atoms][Line Suffix]
49 * [Buffer Suffix]
50 *
51 * 52 * Of course in the simplest encoding schemes, the buffer has no 53 *
distinct prefix of suffix, however all have some fixed relationship 54 *
between the text in an 'atom' and the binary data itself. 55 * 56 * In the
CharacterEncoder and CharacterDecoder classes, one complete 57 * chunk of
data is referred to as a buffer. Encoded buffers 58 * are all text,
and decoded buffers (sometimes just referred to as 59 * buffers) are binary
octets. 60 * 61 * To create a custom decoder, you must, at a minimum, overide
three 62 * abstract methods in this class. 63 *
74 * DecoderClassName: Error message.
75 *
76 * 77 * Several useful decoders have already been written and are 78 *
referenced in the See Also list below. 79 * 80 * @author Chuck McManis 81 * @see
CEFormatException 82 * @see CharacterEncoder 83 * @see UCDecoder 84 * @see
UUDecoder 85 * @see BASE64Decoder 86| 构造器和说明 |
|---|
CharacterDecoder() |
| 限定符和类型 | 方法和说明 |
|---|---|
protected abstract int |
bytesPerAtom()
Return the number of bytes per atom of decoding
|
protected abstract int |
bytesPerLine()
Return the maximum number of bytes that can be encoded per line
|
protected void |
decodeAtom(PushbackInputStream aStream,
OutputStream bStream,
int l)
121 * This method does an actual decode.
|
byte[] |
decodeBuffer(InputStream in)
199 * Decode the contents of the inputstream into a buffer. 200
|
void |
decodeBuffer(InputStream aStream,
OutputStream bStream)
145 * Decode the text from the InputStream and write the decoded 146 *
octets to the OutputStream.
|
byte[] |
decodeBuffer(String inputString)
182 * Alternate decode interface that takes a String containing the
encoded 183 * buffer and returns a byte array containing the data. 184 * @exception
CEFormatException An error has occured while decoding 185
|
protected void |
decodeBufferPrefix(PushbackInputStream aStream,
OutputStream bStream)
decode the beginning of the buffer, by default this is a NOP.
|
protected void |
decodeBufferSuffix(PushbackInputStream aStream,
OutputStream bStream)
decode the buffer suffix, again by default it is a NOP.
|
ByteBuffer |
decodeBufferToByteBuffer(InputStream in)
216 * Decode the contents of the inputStream into a ByteBuffer. 217
|
ByteBuffer |
decodeBufferToByteBuffer(String inputString)
208 * Decode the contents of the String into a ByteBuffer. 209
|
protected int |
decodeLinePrefix(PushbackInputStream aStream,
OutputStream bStream)
103 * This method should return, if it knows, the number of bytes 104 *
that will be decoded.
|
protected void |
decodeLineSuffix(PushbackInputStream aStream,
OutputStream bStream)
113 * This method post processes the line, if there are error detection
114 * or correction codes in a line, they are generally processed by 115
* this method.
|
protected int |
readFully(InputStream in,
byte[] buffer,
int offset,
int len)
130 * This method works around the bizarre semantics of
BufferedInputStream's 131 * read method. 132
|
protected abstract int bytesPerAtom()
protected abstract int bytesPerLine()
protected void decodeBufferPrefix(PushbackInputStream aStream, OutputStream bStream) throws IOException
IOExceptionprotected void decodeBufferSuffix(PushbackInputStream aStream, OutputStream bStream) throws IOException
IOExceptionprotected int decodeLinePrefix(PushbackInputStream aStream, OutputStream bStream) throws IOException
IOExceptionprotected void decodeLineSuffix(PushbackInputStream aStream, OutputStream bStream) throws IOException
IOExceptionprotected void decodeAtom(PushbackInputStream aStream, OutputStream bStream, int l) throws IOException
IOExceptionprotected int readFully(InputStream in, byte[] buffer, int offset, int len) throws IOException
IOExceptionpublic void decodeBuffer(InputStream aStream, OutputStream bStream) throws IOException
IOExceptionpublic byte[] decodeBuffer(String inputString) throws IOException
IOExceptionpublic byte[] decodeBuffer(InputStream in) throws IOException
IOExceptionpublic ByteBuffer decodeBufferToByteBuffer(String inputString) throws IOException
IOExceptionpublic ByteBuffer decodeBufferToByteBuffer(InputStream in) throws IOException
IOExceptionCopyright © 2017. All rights reserved.