ccs.mime
Class Base64OutputStream

java.lang.Object
  extended by java.io.OutputStream
      extended by java.io.FilterOutputStream
          extended by ccs.mime.Base64OutputStream
All Implemented Interfaces:
java.io.Closeable, java.io.Flushable

public class Base64OutputStream
extends java.io.FilterOutputStream

Encodes a binary stream into Base64 encoding.


Field Summary
 
Fields inherited from class java.io.FilterOutputStream
out
 
Constructor Summary
Base64OutputStream(java.io.OutputStream out)
          Create an encoder with default buffer size.
Base64OutputStream(java.io.OutputStream out, int bufsz)
          Create an encoder with the specified buffer size and eventual output.
 
Method Summary
 void close()
          Finish and close the stream.
 void finish()
          Finish the encoding.
 void write(byte[] inbuf, int off, int len)
          Encode a subarray to the stream.
 void write(int b)
           
 
Methods inherited from class java.io.FilterOutputStream
flush, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Base64OutputStream

public Base64OutputStream(java.io.OutputStream out)
Create an encoder with default buffer size. Other comments as the constructor with two parameters.


Base64OutputStream

public Base64OutputStream(java.io.OutputStream out,
                          int bufsz)
Create an encoder with the specified buffer size and eventual output. The encoder buffers output internally for greater efficiency.

Method Detail

write

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

write

public void write(byte[] inbuf,
                  int off,
                  int len)
           throws java.io.IOException
Encode a subarray to the stream.

Overrides:
write in class java.io.FilterOutputStream
Throws:
java.io.IOException

finish

public void finish()
            throws java.io.IOException
Finish the encoding. Call this when you have written all your data in.

Throws:
java.io.IOException

close

public void close()
           throws java.io.IOException
Finish and close the stream.

Specified by:
close in interface java.io.Closeable
Overrides:
close in class java.io.FilterOutputStream
Throws:
java.io.IOException