Top Description Fields Constructors Methods
org.jvnet.staxex

public Class Base64EncoderStream

extends FilterOutputStream
Class Inheritance
Imports
java.io.*, java.util.logging.Level, .Logger, javax.xml.stream.XMLStreamException, .XMLStreamWriter

This class implements a BASE64 Encoder. It is implemented as a FilterOutputStream, so one can just wrap this class around any output stream and write bytes into this filter. The Encoding is done as the bytes are written out.
Authors
John Mani, Bill Shannon, Martin Grebac

Field Summary

Modifier and TypeField and Description
private byte[]
private int
private XMLStreamWriter
private static final char[]
pem_array

This array maps the characters to their 6 bit values

Inherited from java.io.FilterOutputStream:
out

Constructor Summary

AccessConstructor and Description
public
public
Base64EncoderStream(XMLStreamWriter outWriter, OutputStream out)

Create a BASE64 encoder that encodes the specified input stream

Method Summary

Modifier and TypeMethod and Description
public void
close()

Overrides java.io.FilterOutputStream.close.

Implements java.io.Closeable.close.

Forces any buffered output bytes to be encoded out to the stream and closes this output stream

private void
public void
flush()

Overrides java.io.FilterOutputStream.flush.

Implements java.io.Flushable.flush.

Flushes this output stream and forces any buffered output bytes to be encoded out to the stream.

public void
write(byte[]
the data.
b
,
int
the start offset in the data.
off
,
int
the number of bytes to write.
len
)

Overrides java.io.FilterOutputStream.write.

Encodes len bytes from the specified byte array starting at offset off to this output stream.

public void
write(byte[]
the data to be written.
b
)

Overrides java.io.FilterOutputStream.write.

Encodes b.length bytes to this output stream.

public void
write(int
the byte.
c
)

Overrides java.io.FilterOutputStream.write.

Encodes the specified byte to this output stream.

Field Detail

bufferback to summary
private byte[] buffer
bufsizeback to summary
private int bufsize
outWriterback to summary
private XMLStreamWriter outWriter
pem_arrayback to summary
private static final char[] pem_array

This array maps the characters to their 6 bit values

Constructor Detail

Base64EncoderStreamback to summary
public Base64EncoderStream(OutputStream out)
Base64EncoderStreamback to summary
public Base64EncoderStream(XMLStreamWriter outWriter, OutputStream out)

Create a BASE64 encoder that encodes the specified input stream

Method Detail

closeback to summary
public void close() throws IOException

Overrides java.io.FilterOutputStream.close.

Implements java.io.Closeable.close.

Forces any buffered output bytes to be encoded out to the stream and closes this output stream

Annotations
@Override
Exceptions
IOException:

Doc from java.io.FilterOutputStream.close.

if an I/O error occurs.

encodeback to summary
private void encode() throws IOException
flushback to summary
public void flush() throws IOException

Overrides java.io.FilterOutputStream.flush.

Implements java.io.Flushable.flush.

Flushes this output stream and forces any buffered output bytes to be encoded out to the stream.

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs.
writeback to summary
public void write(byte[] b, int off, int len) throws IOException

Overrides java.io.FilterOutputStream.write.

Encodes len bytes from the specified byte array starting at offset off to this output stream.

Parameters
b:byte[]

the data.

off:int

the start offset in the data.

len:int

the number of bytes to write.

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs.
writeback to summary
public void write(byte[] b) throws IOException

Overrides java.io.FilterOutputStream.write.

Encodes b.length bytes to this output stream.

Parameters
b:byte[]

the data to be written.

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs.
writeback to summary
public void write(int c) throws IOException

Overrides java.io.FilterOutputStream.write.

Encodes the specified byte to this output stream.

Parameters
c:int

the byte.

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs.