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:
java.io.Closeable,java.io.Flushable,java.lang.AutoCloseable
- Direct Known Subclasses:
Base32OutputStream,Base64OutputStream
public class BaseNCodecOutputStream extends java.io.FilterOutputStream
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
- Version:
- $Id: BaseNCodecOutputStream.java 1744727 2016-05-20 12:43:52Z sebb $
-
-
Constructor Summary
Constructors Constructor Description BaseNCodecOutputStream(java.io.OutputStream out, BaseNCodec basedCodec, boolean doEncode)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()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.voidwrite(byte[] b, int offset, int len)Writeslenbytes from the specifiedbarray starting atoffsetto this output stream.voidwrite(int i)Writes the specifiedbyteto this output stream.
-
-
-
Constructor Detail
-
BaseNCodecOutputStream
public BaseNCodecOutputStream(java.io.OutputStream out, BaseNCodec basedCodec, boolean doEncode)
-
-
Method Detail
-
write
public void write(int i) throws java.io.IOException
Writes the specifiedbyteto this output stream.- Overrides:
writein classjava.io.FilterOutputStream- Parameters:
i- source byte- Throws:
java.io.IOException- if an I/O error occurs.
-
write
public void write(byte[] b, int offset, int len) throws java.io.IOException
Writeslenbytes from the specifiedbarray starting atoffsetto this output stream.- Overrides:
writein classjava.io.FilterOutputStream- Parameters:
b- source byte arrayoffset- where to start reading the byteslen- maximum number of bytes to write- Throws:
java.io.IOException- if an I/O error occurs.java.lang.NullPointerException- if the byte array parameter is nulljava.lang.IndexOutOfBoundsException- if offset, len or buffer size are invalid
-
flush
public void flush() throws java.io.IOException
Flushes this output stream and forces any buffered output bytes to be written out to the stream.- Specified by:
flushin interfacejava.io.Flushable- Overrides:
flushin classjava.io.FilterOutputStream- Throws:
java.io.IOException- if an I/O error occurs.
-
close
public void close() throws java.io.IOException
Closes 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 interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Overrides:
closein classjava.io.FilterOutputStream- Throws:
java.io.IOException- if an I/O error occurs.
-
eof
public void eof() throws java.io.IOException
Writes EOF.- Throws:
java.io.IOException- if an I/O error occurs.- Since:
- 1.11
-
-