|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.io.InputStream
java.io.FilterInputStream
org.spaceroots.jarmor.AbstractDecoder
org.spaceroots.jarmor.UUDecoder
This class decodes a text stream containing into a binary stream.
The UU encoding is suitable when binary data needs to be transmitted or stored as text. It was used to send binary data through UUCP (Unix to Unix Copy Protocol). The encoded text uses a subset of the ASCII character set.
The encoded data is preceded by a header line starting with the
keyword begin and it is followed by two trailer lines,
the last one starting with the keyword end. Lines preceding
the header line or following the trailer lines are allowed and silently
ignored.
The encoded stream is about 38% larger than the corresponding binary stream (6 binary bits are converted into 8 encoded bits, there are stream header and trailer, and each 60 encoded bytes chunk is started by a control character and ended by a newline).
UUEncoder| Field Summary | |
protected byte[] |
encoded
Encoded bytes buffer. |
protected boolean |
endReached
End indicator. |
protected int |
nEncoded
Number of bytes already in the encoded array. |
| Fields inherited from class java.io.FilterInputStream |
in |
| Constructor Summary | |
UUDecoder(InputStream in)
Create a decoder wrapping a source of encoded data. |
|
| Method Summary | |
int |
available()
Get the number of bytes that can be read from this input stream without blocking. |
void |
close()
Close the stream. |
protected int |
filterBytes()
Filter some bytes from the underlying stream. |
int |
getGroupPerms()
Get the access permissions for the group of the file. |
String |
getName()
Get the name of the file. |
int |
getOthersPerms()
Get the access permissions for others. |
int |
getUserPerms()
Get the access permissions for the user (owner) of the file. |
boolean |
markSupported()
Check if the FilterInputStream.mark(int) and
FilterInputStream.reset() methods are supported. |
protected void |
putFilteredByte(int b)
Put a filtered byte in the buffer. |
int |
read()
Reads the next byte of data from this input stream. |
int |
read(byte[] b,
int off,
int len)
Reads up to len bytes of data from this input stream into an array of bytes. |
protected int |
readEncodedBytes()
Read new encoded bytes. |
long |
skip(long n)
Skips over and discards n bytes of data from the input stream. |
| Methods inherited from class java.io.FilterInputStream |
mark, read, reset |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected byte[] encoded
protected int nEncoded
protected boolean endReached
| Constructor Detail |
public UUDecoder(InputStream in)
in - source of encoded data to decode| Method Detail |
public String getName()
This name is relevant only if the decoded data is to be stored in a file, it is the name that was provided inside the stream by the encoder.
public int getUserPerms()
These permissions are relevant only if the decoded data is to be
stored in a file, the value returned was provided inside the stream
by the encoder. They are specified by or-ing together the desired
bits patterns UUEncoder.READ, UUEncoder.WRITE and
UUEncoder.EXECUTE.
getGroupPerms(),
getOthersPerms()public int getGroupPerms()
These permissions are relevant only if the decoded data is to be
stored in a file, the value returned was provided inside the stream
by the encoder. They are specified by or-ing together the desired
bits patterns UUEncoder.READ, UUEncoder.WRITE and
UUEncoder.EXECUTE.
getUserPerms(),
getOthersPerms()public int getOthersPerms()
These permissions are relevant only if the decoded data is to be
stored in a file, the value returned was provided inside the stream
by the encoder. They are specified by or-ing together the desired
bits patterns UUEncoder.READ, UUEncoder.WRITE and
UUEncoder.EXECUTE.
getUserPerms(),
getGroupPerms()
protected int filterBytes()
throws IOException
IOException - if the underlying stream throws oneAbstractDecoder.putFilteredByte(int)
public int available()
throws IOException
IOException - if the underlying stream throws one
public int read()
throws IOException
IOException - if the underlying stream throws one
public int read(byte[] b,
int off,
int len)
throws IOException
b - the buffer into which the data is read.off - the start offset of the data.len - the maximum number of bytes read.
IOException - if the underlying stream throws one
public long skip(long n)
throws IOException
n - the number of bytes to be skipped
IOException - if the underlying stream throws one
public void close()
throws IOException
IOException - if the underlying stream throws onepublic boolean markSupported()
FilterInputStream.mark(int) and
FilterInputStream.reset() methods are supported.
protected int readEncodedBytes()
throws IOException
IOException - if the underlying stream throws oneprotected void putFilteredByte(int b)
The filtered bytes buffer will be expanded if it already contains too many pending bytes.
b - byte to put in the filtered buffer
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||