org.mozilla.jss.util

Class Base64OutputStream

public class Base64OutputStream extends FilterOutputStream

An output stream filter that takes arbitrary bytes and outputs their base64 encoding. Call flush() or close() to write out the final padding. The class also automatically puts line breaks in the output stream.
Constructor Summary
Base64OutputStream(PrintStream out)
Create a stream that does not insert line breaks.
Base64OutputStream(PrintStream out, int quadsPerLine)
Method Summary
voidclose()
This flushes the stream and closes the next stream downstream.
voidflush()
Calling this will put the ending padding on the base64 stream, so don't call it until you have no data left.
voidwrite(int oneByte)
voidwrite(byte[] buffer)
voidwrite(byte[] buffer, int offset, int count)

Constructor Detail

Base64OutputStream

public Base64OutputStream(PrintStream out)
Create a stream that does not insert line breaks. To have line breaks, use the other constructor.

Base64OutputStream

public Base64OutputStream(PrintStream out, int quadsPerLine)

Parameters: quadsPerLine Number of 4-character blocks to write before outputting a line break. For example, for 76-characters per line, pass in 76/4 = 19.

Method Detail

close

public void close()
This flushes the stream and closes the next stream downstream.

flush

public void flush()
Calling this will put the ending padding on the base64 stream, so don't call it until you have no data left. The class does no unnecessary buffering, so you probably shouldn't call it at all.

write

public void write(int oneByte)

write

public void write(byte[] buffer)

write

public void write(byte[] buffer, int offset, int count)