gnu.mail.util

Class Base64OutputStream

Known Direct Subclasses:
BOutputStream

public class Base64OutputStream
extends FilterOutputStream

A Base64 content transfer encoding filter stream.

From RFC 2045, section 6.8:

The Base64 Content-Transfer-Encoding is designed to represent arbitrary sequences of octets in a form that need not be humanly readable. The encoding and decoding algorithms are simple, but the encoded data are consistently only about 33 percent larger than the unencoded data.

Constructor Summary

Base64OutputStream(OutputStream out)
Default constructor.
Base64OutputStream(OutputStream out, int lineLength)
Constructor.

Method Summary

void
close()
Closes this output stream and releases any system resources associated with this stream.
void
flush()
Flushes this output stream and forces any buffered output bytes to be written out.
void
write(b[] )
Writes b.length bytes from the specified byte array to this output stream.
void
write(b[] , int off, int len)
Writes len bytes from the specified byte array starting at offset off to this output stream.
void
write(int c)
Writes the specified byte to this output stream.

Constructor Details

Base64OutputStream

public Base64OutputStream(OutputStream out)
Default constructor. This constructs a Base64OutputStream with a line length of 76.


Base64OutputStream

public Base64OutputStream(OutputStream out,
                          int lineLength)
Constructor.

Parameters:
out - the underlying output stream to encode
lineLength - the line length

Method Details

close

public void close()
            throws IOException
Closes this output stream and releases any system resources associated with this stream.


flush

public void flush()
            throws IOException
Flushes this output stream and forces any buffered output bytes to be written out.


write

public void write(b[] )
            throws IOException
Writes b.length bytes from the specified byte array to this output stream.


write

public void write(b[] ,
                  int off,
                  int len)
            throws IOException
Writes len bytes from the specified byte array starting at offset off to this output stream.


write

public void write(int c)
            throws IOException
Writes the specified byte to this output stream.