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 voidclose()final voidcomplete()Write out any pending data, including padding if necessary.protected abstract voiddoClose()Close the underlying stream, if applicable.protected abstract voiddoFlush()Flush the underlying stream, if applicable.protected abstract voiddoWrite(byte[] b) Write base64 encoded data.final voidflush()protected abstract voidWrite any pending data to the underlying stream, if applicable.final voidwrite(byte[] b, int off, int len) final voidwrite(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 totrueis 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)withignoreFlushset tofalse.
-
-
Method Details
-
write
- Overrides:
writein classOutputStream- Throws:
IOException
-
write
- Specified by:
writein classOutputStream- Throws:
IOException
-
complete
Write out any pending data, including padding if necessary.- Throws:
IOException- if an I/O error occurs
-
flush
- Specified by:
flushin interfaceFlushable- Overrides:
flushin classOutputStream- Throws:
IOException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein 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
-