org.brains2b.coffee.decode
Class UUDecoder

java.lang.Object
  extended by org.brains2b.coffee.decode.UUDecoder
All Implemented Interfaces:
Decoder, Encoder

public class UUDecoder
extends java.lang.Object
implements Decoder, Encoder

Decoder and Encoder for UUEncoding

Version:
1.00 [26-08-2007]
Author:
dennis@brains2b.nl

Constructor Summary
UUDecoder()
           
 
Method Summary
 void decodePiece(java.lang.String s)
          hand a piece of coded characters to the Decoder
 java.lang.String encode(java.io.File f, int part, int size)
          Encode part of the file into the appropriate encoding.
 FileMessage getFileMessage()
          get the FileMessage with a reference to the decoded bytes
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UUDecoder

public UUDecoder()
Method Detail

decodePiece

public void decodePiece(java.lang.String s)
                 throws java.lang.Exception
Description copied from interface: Decoder
hand a piece of coded characters to the Decoder

Specified by:
decodePiece in interface Decoder
Parameters:
s - String, a piece or the complete encoded characters to decode
Throws:
java.lang.Exception
See Also:
Decoder.getFileMessage()

getFileMessage

public FileMessage getFileMessage()
                           throws java.lang.Exception
Description copied from interface: Decoder
get the FileMessage with a reference to the decoded bytes

Specified by:
getFileMessage in interface Decoder
Returns:
FileMessage the reference to the decoded bytes and possible file information
Throws:
java.lang.Exception

encode

public java.lang.String encode(java.io.File f,
                               int part,
                               int size)
Encode part of the file into the appropriate encoding.

Between (part-1)*size and part*size or File.length() is what will be encoded and returned

size is adjusted down from the supplied size to be a multiple of 45, so UUEncode will encode whole lines for multi-part message

Specified by:
encode in interface Encoder
Parameters:
f - File, the file to partially encode
part - int, the part of the file to encode starting at 1
size - int, The block size of the parts.
Returns:
String the encoded text in a style appropriate for the encoding