public class

UUDecoder

extends CharacterDecoder
java.lang.Object
   ↳ sun.misc.CharacterDecoder
     ↳ sun.misc.UUDecoder

Class Overview

This class implements a Berkeley uu character decoder. This decoder was made famous by the uudecode program. The basic character coding is algorithmic, taking 6 bits of binary data and adding it to an ASCII ' ' (space) character. This converts these six bits into a printable representation. Note that it depends on the ASCII character encoding standard for english. Groups of three bytes are converted into 4 characters by treating the three bytes a four 6 bit groups, group 1 is byte 1's most significant six bits, group 2 is byte 1's least significant two bits plus byte 2's four most significant bits. etc. In this encoding, the buffer prefix is:

     begin [mode] [filename]
 
This is followed by one or more lines of the form:
      (len)(data)(data)(data) ...
 
where (len) is the number of bytes on this line. Note that groupings are always four characters, even if length is not a multiple of three bytes. When less than three characters are encoded, the values of the last remaining bytes is undefined and should be ignored. The last line of data in a uuencoded buffer is represented by a single space character. This is translated by the decoding engine to a line length of zero. This is immediately followed by a line which contains the word 'end[newline]' If an error is encountered during decoding this class throws a CEFormatException. The specific detail messages are:
      "UUDecoder: No begin line."
      "UUDecoder: Malformed begin line."
      "UUDecoder: Short Buffer."
      "UUDecoder: Bad Line Length."
      "UUDecoder: Missing 'end' line."
 

Summary

Fields
public String bufferName This string contains the name that was in the buffer being decoded.
public int mode Represents UNIX(tm) mode bits.
Public Constructors
UUDecoder()
Protected Methods
int bytesPerAtom()
UU encoding specifies 3 bytes per atom.
int bytesPerLine()
All UU lines have 45 bytes on them, for line length of 15*4+1 or 61 characters per line.
void decodeAtom(PushbackInputStream inStream, OutputStream outStream, int l)
Decode a UU atom.
void decodeBufferPrefix(PushbackInputStream inStream, OutputStream outStream)
For uuencoded buffers, the data begins with a line of the form: begin MODE FILENAME This line always starts in column 1.
void decodeBufferSuffix(PushbackInputStream inStream, OutputStream outStream)
UUencoded files have a buffer suffix which consists of the word end.
int decodeLinePrefix(PushbackInputStream inStream, OutputStream outStream)
In uuencoded buffers, encoded lines start with a character that represents the number of bytes encoded in this line.
void decodeLineSuffix(PushbackInputStream inStream, OutputStream outStream)
Find the end of the line for the next operation.
[Expand]
Inherited Methods
From class sun.misc.CharacterDecoder
From class java.lang.Object

Fields

public String bufferName

This string contains the name that was in the buffer being decoded.

public int mode

Represents UNIX(tm) mode bits. Generally three octal digits representing read, write, and execute permission of the owner, group owner, and others. They should be interpreted as the bit groups:

 (owner) (group) (others)
  rwx      rwx     rwx    (r = read, w = write, x = execute)

Public Constructors

public UUDecoder ()

Protected Methods

protected int bytesPerAtom ()

UU encoding specifies 3 bytes per atom.

protected int bytesPerLine ()

All UU lines have 45 bytes on them, for line length of 15*4+1 or 61 characters per line.

protected void decodeAtom (PushbackInputStream inStream, OutputStream outStream, int l)

Decode a UU atom. Note that if l is less than 3 we don't write the extra bits, however the encoder always encodes 4 character groups even when they are not needed.

Throws
IOException

protected void decodeBufferPrefix (PushbackInputStream inStream, OutputStream outStream)

For uuencoded buffers, the data begins with a line of the form: begin MODE FILENAME This line always starts in column 1.

Throws
IOException

protected void decodeBufferSuffix (PushbackInputStream inStream, OutputStream outStream)

UUencoded files have a buffer suffix which consists of the word end. This line should immediately follow the line with a single space in it.

Throws
IOException

protected int decodeLinePrefix (PushbackInputStream inStream, OutputStream outStream)

In uuencoded buffers, encoded lines start with a character that represents the number of bytes encoded in this line. The last line of input is always a line that starts with a single space character, which would be a zero length line.

Throws
IOException

protected void decodeLineSuffix (PushbackInputStream inStream, OutputStream outStream)

Find the end of the line for the next operation. The following sequences are recognized as end-of-line CR, CR LF, or LF

Throws
IOException