public abstract class AbstractBase64EncodingOutputStream extends OutputStream
OutputStream
implementations that encode data in base64.Constructor and Description |
---|
AbstractBase64EncodingOutputStream()
Default constructor.
|
AbstractBase64EncodingOutputStream(boolean ignoreFlush)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
close() |
void |
complete()
Write out any pending data, including padding if necessary.
|
protected abstract void |
doClose()
Close the underlying stream, if applicable.
|
protected abstract void |
doFlush()
Flush the underlying stream, if applicable.
|
protected abstract void |
doWrite(byte[] b)
Write base64 encoded data.
|
void |
flush() |
protected abstract void |
flushBuffer()
Write any pending data to the underlying stream, if applicable.
|
void |
write(byte[] b,
int off,
int len) |
void |
write(int b) |
write
public AbstractBase64EncodingOutputStream(boolean ignoreFlush)
ignoreFlush
- Specifies if calls to flush()
should be ignored. Setting this to
true
is particular useful in conjunction with
DataHandler.writeTo(OutputStream)
: that method may call flush()
after writing the data, but the call to DataHandler.writeTo(OutputStream)
must be followed by a call to close()
or complete()
which would
then output a single chunk with a few bytes. In some cases this may be
inconvenient.public AbstractBase64EncodingOutputStream()
AbstractBase64EncodingOutputStream(boolean)
with ignoreFlush
set to
false
.public final void write(byte[] b, int off, int len) throws IOException
write
in class OutputStream
IOException
public final void write(int b) throws IOException
write
in class OutputStream
IOException
public final void complete() throws IOException
IOException
- if an I/O error occurspublic final void flush() throws IOException
flush
in interface Flushable
flush
in class OutputStream
IOException
public final void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in class OutputStream
IOException
protected abstract void doWrite(byte[] b) throws IOException
b
- a byte array of length 4IOException
- if an I/O error occursprotected abstract void flushBuffer() throws IOException
IOException
- if an I/O error occursprotected abstract void doFlush() throws IOException
IOException
- if an I/O error occursprotected abstract void doClose() throws IOException
IOException
- if an I/O error occursCopyright © The Apache Software Foundation. All Rights Reserved.