org.yajul.io
Class Base64OutputStream

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

public class Base64OutputStream
extends java.io.FilterOutputStream

Provides BASE64 encoding of binary data as an output stream filter. Bytes written to this output stream filter will be encoded using the BASE64 encoding rules, as defined in MIME specification and written to the underlying output stream.

Author:
josh (Refactored from old 'Intira' code)

Field Summary
 
Fields inherited from class java.io.FilterOutputStream
out
 
Constructor Summary
Base64OutputStream(java.io.OutputStream out)
          Creates a new BASE64 encoding output stream.
 
Method Summary
 void flush()
          Flushes this output stream and forces any buffered output bytes to be written out to the stream.
 void write(int b)
          Writes the specified byte to this output stream.
 
Methods inherited from class java.io.FilterOutputStream
close, write, 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)
Creates a new BASE64 encoding output stream.

Parameters:
out - The underlying output stream.
Method Detail

write

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

The write method of FilterOutputStream calls the write method of its underlying output stream, that is, it performs out.write(b).

Implements the abstract write method of OutputStream.

Overrides:
write in class java.io.FilterOutputStream
Parameters:
b - the byte.
Throws:
java.io.IOException - if an I/O error occurs.

flush

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

The flush method of FilterOutputStream calls the flush method of its underlying output stream.

Specified by:
flush in interface java.io.Flushable
Overrides:
flush in class java.io.FilterOutputStream
Throws:
java.io.IOException - if an I/O error occurs.
See Also:
FilterOutputStream.out


Copyright © 2008. All Rights Reserved.