BaseNCodecOutputStream (Encode/Decode Utilities (Version 1.10))
Date: 2016-03-08

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:
    Base32OutputStream, Base64OutputStream

      public class BaseNCodecOutputStream
      extends FilterOutputStream

  Abstract superclass for Base-N output streams.
  Since:
    1.5
  Version:
    $Id: BaseNCodecOutputStream.java 1544347 2013-11-21 22:30:31Z ggregory $

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `private BaseNCodec` | `baseNCodec`
    `private BaseNCodec.Context` | `context`
    `private boolean` | `doEncode`
    `private byte[]` | `singleByte`

    - ### Fields inherited from class java.io.FilterOutputStream

      `out`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `BaseNCodecOutputStream(OutputStream out, BaseNCodec basedCodec, boolean doEncode)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()` Closes this output stream and releases any system resources associated with the stream.
    `void` | `flush()` Flushes this output stream and forces any buffered output bytes to be written out to the stream.
    `private void` | `flush(boolean propagate)` Flushes this output stream and forces any buffered output bytes to be written out to the stream.
    `void` | `write(byte[] b, int offset, int len)` Writes `len` bytes from the specified `b` array starting at `offset` to this output stream.
    `void` | `write(int i)` Writes the specified `byte` to this output stream.

    - ### Methods inherited from class java.io.FilterOutputStream

      `write`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### doEncode

          private final boolean doEncode

    - #### baseNCodec

          private final BaseNCodec baseNCodec

    - #### singleByte

          private final byte[] singleByte

    - #### context

          private final BaseNCodec.Context context

  - ### Constructor Detail

    - #### BaseNCodecOutputStream

          public BaseNCodecOutputStream(OutputStream out,
                                BaseNCodec basedCodec,
                                boolean doEncode)

  - ### Method Detail

    - #### write

          public void write(int i)
                     throws IOException

      Writes the specified `byte` to this output stream.
      Overrides:
        `write` in class `FilterOutputStream`
      Parameters:
        `i` - source byte
      Throws:
        `IOException` - if an I/O error occurs.

    - #### write

          public void write(byte[] b,
                   int offset,
                   int len)
                     throws IOException

      Writes `len` bytes from the specified `b` array starting at `offset` to this output stream.
      Overrides:
        `write` in class `FilterOutputStream`
      Parameters:
        `b` - 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

    - #### flush

          private void flush(boolean propagate)
                      throws IOException

      Flushes this output stream and forces any buffered output bytes to be written out to the stream. If propagate is true, the wrapped stream will also be flushed.
      Parameters:
        `propagate` - boolean flag to indicate whether the wrapped OutputStream should also be flushed.
      Throws:
        `IOException` - if an I/O error occurs.

    - #### flush

          public void flush()
                     throws IOException

      Flushes this output stream and forces any buffered output bytes to be written out to the stream.
      Specified by:
        `flush` in interface `Flushable`
      Overrides:
        `flush` in class `FilterOutputStream`
      Throws:
        `IOException` - if an I/O error occurs.

    - #### close

          public void close()
                     throws IOException

      Closes this output stream and releases any system resources associated with the stream.
      Specified by:
        `close` in interface `Closeable`
      Specified by:
        `close` in interface `AutoCloseable`
      Overrides:
        `close` in class `FilterOutputStream`
      Throws:
        `IOException` - if an I/O error occurs.

commons-codec version 1.10 - Copyright © 2002-2016 - Apache Software Foundation