net.groboclown.util.io.v1
Class MimeOutputStream

java.lang.Object
  |
  +--java.io.OutputStream
        |
        +--java.io.FilterOutputStream
              |
              +--net.groboclown.util.io.v1.MimeOutputStream

public class MimeOutputStream
extends FilterOutputStream

java.io.FilterOutputStream implementation for Mime base 64. Not incredibly efficient, but it works and is small. All we need to implement are: write(int) flush()


Field Summary
private  int bits
           
private static int[] charset
          Mime character set translation
private static int pad
           
private  int spare
           
 
Fields inherited from class java.io.FilterOutputStream
out
 
Constructor Summary
MimeOutputStream(OutputStream o)
          Constructor!
 
Method Summary
 void flush()
          Flush the stream.
 void write(int c)
          Write the specified byte, performing mime encoding.
 
Methods inherited from class java.io.FilterOutputStream
close, write, write
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

bits

private int bits

spare

private int spare

charset

private static final int[] charset
Mime character set translation

pad

private static final int pad
Constructor Detail

MimeOutputStream

public MimeOutputStream(OutputStream o)
Constructor!
Method Detail

write

public void write(int c)
           throws IOException
Write the specified byte, performing mime encoding.

Override this method, since all other write methods call it.

Overrides:
write in class FilterOutputStream
Throws:
IOException - If an I/O error occurs

flush

public void flush()
           throws IOException
Flush the stream. If the stream has saved any characters from the various write() methods in a buffer, write them immediately to their intended destination. Then, if that destination is another character or byte stream, flush it. Thus one flush() invocation will flush all the buffers in a chain of Writers and OutputStreams. This version does not buffer, but Mime encoding may have some trailing stuff, which needs padding.
Overrides:
flush in class FilterOutputStream
Throws:
IOException - If an I/O error occurs


Written under the LGPL