org.apache.geronimo.mail.util
Class UUEncoderStream

java.lang.Object
  extended by java.io.OutputStream
      extended by java.io.FilterOutputStream
          extended by org.apache.geronimo.mail.util.UUEncoderStream
All Implemented Interfaces:
java.io.Closeable, java.io.Flushable

public class UUEncoderStream
extends java.io.FilterOutputStream

An implementation of a FilterOutputStream that encodes the stream data in UUencoding format. This version does the encoding "on the fly" rather than encoding a single block of data. Since this version is intended for use by the MimeUtilty class, it also handles line breaks in the encoded data.

Version:
$Rev: 467553 $ $Date: 2006-10-25 06:01:51 +0200 (Wed, 25 Oct 2006) $

Field Summary
protected  boolean beginWritten
           
protected  byte[] buffer
           
protected  int bufferedBytes
           
protected static int DEFAULT_MODE
           
protected static java.lang.String DEFAULT_NAME
           
protected  UUEncoder encoder
           
protected static int MAX_CHARS_PER_LINE
           
protected  int mode
           
protected  java.lang.String name
           
 
Fields inherited from class java.io.FilterOutputStream
out
 
Constructor Summary
UUEncoderStream(java.io.OutputStream out)
          Create a Base64 encoder stream that wraps a specifed stream using the default line break size.
UUEncoderStream(java.io.OutputStream out, java.lang.String name)
          Create a Base64 encoder stream that wraps a specifed stream using the default line break size.
UUEncoderStream(java.io.OutputStream out, java.lang.String name, int mode)
           
 
Method Summary
 void close()
           
 void flush()
           
 void write(byte[] data)
           
 void write(byte[] data, int offset, int length)
           
 void write(int ch)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_MODE

protected static final int DEFAULT_MODE
See Also:
Constant Field Values

DEFAULT_NAME

protected static final java.lang.String DEFAULT_NAME
See Also:
Constant Field Values

MAX_CHARS_PER_LINE

protected static final int MAX_CHARS_PER_LINE
See Also:
Constant Field Values

name

protected java.lang.String name

mode

protected int mode

beginWritten

protected boolean beginWritten

encoder

protected UUEncoder encoder

bufferedBytes

protected int bufferedBytes

buffer

protected byte[] buffer
Constructor Detail

UUEncoderStream

public UUEncoderStream(java.io.OutputStream out)
Create a Base64 encoder stream that wraps a specifed stream using the default line break size.

Parameters:
out - The wrapped output stream.

UUEncoderStream

public UUEncoderStream(java.io.OutputStream out,
                       java.lang.String name)
Create a Base64 encoder stream that wraps a specifed stream using the default line break size.

Parameters:
out - The wrapped output stream.
name - The filename placed on the "begin" command.

UUEncoderStream

public UUEncoderStream(java.io.OutputStream out,
                       java.lang.String name,
                       int mode)
Method Detail

write

public void write(int ch)
           throws java.io.IOException
Overrides:
write in class java.io.FilterOutputStream
Throws:
java.io.IOException

write

public void write(byte[] data)
           throws java.io.IOException
Overrides:
write in class java.io.FilterOutputStream
Throws:
java.io.IOException

write

public void write(byte[] data,
                  int offset,
                  int length)
           throws java.io.IOException
Overrides:
write in class java.io.FilterOutputStream
Throws:
java.io.IOException

flush

public void flush()
           throws java.io.IOException
Specified by:
flush in interface java.io.Flushable
Overrides:
flush in class java.io.FilterOutputStream
Throws:
java.io.IOException

close

public void close()
           throws java.io.IOException
Specified by:
close in interface java.io.Closeable
Overrides:
close in class java.io.FilterOutputStream
Throws:
java.io.IOException