Package org.apache.commons.codec.binary
Class BaseNCodecOutputStream
java.lang.Object
java.io.OutputStream
java.io.FilterOutputStream
org.apache.commons.codec.binary.BaseNCodecOutputStream
- All Implemented Interfaces:
- Closeable,- Flushable,- AutoCloseable
- Direct Known Subclasses:
- Base16OutputStream,- Base32OutputStream,- Base64OutputStream
Abstract superclass for Base-N output streams.
 
 To write the EOF marker without closing the stream, call eof() or use an Apache Commons IO CloseShieldOutputStream.
 
- Since:
- 1.5
- 
Field SummaryFields inherited from class java.io.FilterOutputStreamout
- 
Constructor SummaryConstructorsConstructorDescriptionBaseNCodecOutputStream(OutputStream outputStream, BaseNCodec basedCodec, boolean doEncode) Constructs a new instance.
- 
Method SummaryModifier and TypeMethodDescriptionvoidclose()Closes this output stream and releases any system resources associated with the stream.voideof()Writes EOF.voidflush()Flushes this output stream and forces any buffered output bytes to be written out to the stream.booleanReturns true if decoding behavior is strict.voidwrite(byte[] array, int offset, int len) Writeslenbytes from the specifiedbarray starting atoffsetto this output stream.voidwrite(int i) Writes the specifiedbyteto this output stream.Methods inherited from class java.io.FilterOutputStreamwrite
- 
Constructor Details- 
BaseNCodecOutputStreamConstructs a new instance. TODO should this be protected?- Parameters:
- outputStream- the underlying output or null.
- basedCodec- a BaseNCodec.
- doEncode- true to encode, false to decode, TODO should be an enum?
 
 
- 
- 
Method Details- 
closeCloses this output stream and releases any system resources associated with the stream.To write the EOF marker without closing the stream, call eof()or use an Apache Commons IO CloseShieldOutputStream.- Specified by:
- closein interface- AutoCloseable
- Specified by:
- closein interface- Closeable
- Overrides:
- closein class- FilterOutputStream
- Throws:
- IOException- if an I/O error occurs.
 
- 
eofWrites EOF.- Since:
- 1.11
 
- 
flushFlushes this output stream and forces any buffered output bytes to be written out to the stream.- Specified by:
- flushin interface- Flushable
- Overrides:
- flushin class- FilterOutputStream
- Throws:
- IOException- if an I/O error occurs.
 
- 
isStrictDecodingReturns true if decoding behavior is strict. Decoding will raise anIllegalArgumentExceptionif trailing bits are not part of a valid encoding.The default is false for lenient encoding. Decoding will compose trailing bits into 8-bit bytes and discard the remainder. - Returns:
- true if using strict decoding
- Since:
- 1.15
 
- 
writeWriteslenbytes from the specifiedbarray starting atoffsetto this output stream.- Overrides:
- writein class- FilterOutputStream
- Parameters:
- array- source byte array
- offset- where to start reading the bytes
- len- maximum number of bytes to write
- Throws:
- IOException- if an I/O error occurs.
- NullPointerException- if the byte array parameter is null
- IndexOutOfBoundsException- if offset, len or buffer size are invalid
 
- 
writeWrites the specifiedbyteto this output stream.- Overrides:
- writein class- FilterOutputStream
- Parameters:
- i- source byte
- Throws:
- IOException- if an I/O error occurs.
 
 
-