Package org.apache.axiom.util.base64
Class AbstractBase64EncodingOutputStream
java.lang.Object
java.io.OutputStream
org.apache.axiom.util.base64.AbstractBase64EncodingOutputStream
- All Implemented Interfaces:
Closeable
,Flushable
,AutoCloseable
- Direct Known Subclasses:
Base64EncodingOutputStream
,Base64EncodingStringBufferOutputStream
,Base64EncodingWriterOutputStream
Base class for
OutputStream
implementations that encode data in base64.-
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor.AbstractBase64EncodingOutputStream
(boolean ignoreFlush) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionfinal void
close()
final 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.final void
flush()
protected abstract void
Write any pending data to the underlying stream, if applicable.final void
write
(byte[] b, int off, int len) final void
write
(int b) Methods inherited from class java.io.OutputStream
nullOutputStream, write
-
Constructor Details
-
AbstractBase64EncodingOutputStream
public AbstractBase64EncodingOutputStream(boolean ignoreFlush) Constructor.- Parameters:
ignoreFlush
- Specifies if calls toflush()
should be ignored. Setting this totrue
is particular useful in conjunction withDataHandler.writeTo(OutputStream)
: that method may callflush()
after writing the data, but the call toDataHandler.writeTo(OutputStream)
must be followed by a call toclose()
orcomplete()
which would then output a single chunk with a few bytes. In some cases this may be inconvenient.
-
AbstractBase64EncodingOutputStream
public AbstractBase64EncodingOutputStream()Default constructor. This constructor does the same asAbstractBase64EncodingOutputStream(boolean)
withignoreFlush
set tofalse
.
-
-
Method Details
-
write
- Overrides:
write
in classOutputStream
- Throws:
IOException
-
write
- Specified by:
write
in classOutputStream
- Throws:
IOException
-
complete
Write out any pending data, including padding if necessary.- Throws:
IOException
- if an I/O error occurs
-
flush
- Specified by:
flush
in interfaceFlushable
- Overrides:
flush
in classOutputStream
- Throws:
IOException
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classOutputStream
- Throws:
IOException
-
doWrite
Write base64 encoded data. If necessary, the implementation should accumulate the data in a buffer before writing it to the underlying stream.- Parameters:
b
- a byte array of length 4- Throws:
IOException
- if an I/O error occurs
-
flushBuffer
Write any pending data to the underlying stream, if applicable. Note that implementations should not flush the underlying stream.- Throws:
IOException
- if an I/O error occurs
-
doFlush
Flush the underlying stream, if applicable.- Throws:
IOException
- if an I/O error occurs
-
doClose
Close the underlying stream, if applicable.- Throws:
IOException
- if an I/O error occurs
-