xmlgraphics-commons 2.1

org.apache.xmlgraphics.util.io
Class Base64EncodeStream

java.lang.Object
  extended by java.io.OutputStream
      extended by org.apache.xmlgraphics.util.io.Base64EncodeStream
All Implemented Interfaces:
Closeable, Flushable

public class Base64EncodeStream
extends OutputStream

This class implements a Base64 Character encoder as specified in RFC1113. Unlike some other encoding schemes there is nothing in this encoding that indicates where a buffer starts or ends. This means that the encoded text will simply start with the first line of encoded text and end with the last line of encoded text.

Version:
$Id: Base64EncodeStream.java 1681108 2015-05-22 13:26:12Z ssteiner $ Originally authored by Thomas DeWeese, Vincent Hardy, and Chuck McManis.

Constructor Summary
Base64EncodeStream(OutputStream out)
           
Base64EncodeStream(OutputStream out, boolean closeOutOnClose)
           
 
Method Summary
 void close()
           
 void flush()
          This can't really flush out output since that may generate '=' chars which would indicate the end of the stream.
 void write(byte[] data)
           
 void write(byte[] data, int off, int len)
           
 void write(int b)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Base64EncodeStream

public Base64EncodeStream(OutputStream out)

Base64EncodeStream

public Base64EncodeStream(OutputStream out,
                          boolean closeOutOnClose)
Method Detail

close

public void close()
           throws IOException
Specified by:
close in interface Closeable
Overrides:
close in class OutputStream
Throws:
IOException

flush

public void flush()
           throws IOException
This can't really flush out output since that may generate '=' chars which would indicate the end of the stream. Instead we flush out. You can only be sure all output is writen by closing this stream.

Specified by:
flush in interface Flushable
Overrides:
flush in class OutputStream
Throws:
IOException

write

public void write(int b)
           throws IOException
Specified by:
write in class OutputStream
Throws:
IOException

write

public void write(byte[] data)
           throws IOException
Overrides:
write in class OutputStream
Throws:
IOException

write

public void write(byte[] data,
                  int off,
                  int len)
           throws IOException
Overrides:
write in class OutputStream
Throws:
IOException

xmlgraphics-commons 2.1

Copyright 1999-2016 The Apache Software Foundation. All Rights Reserved.