Class BaseNCodecOutputStream<C extends BaseNCodec,​T extends BaseNCodecOutputStream<C,​T,​B>,​B extends BaseNCodecOutputStream.AbstractBuilder<T,​C,​B>>

    • Field Summary

      • Fields inherited from class java.io.FilterOutputStream

        out
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()
      Closes this output stream and releases any system resources associated with the stream.
      void eof()
      Notifies the decoder or encoder of EOF (-1).
      void flush()
      Flushes this output stream and forces any buffered output bytes to be written out to the stream.
      boolean isStrictDecoding()
      Tests whether decoding behavior is strict.
      void write​(byte[] array, 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.io.OutputStream

        nullOutputStream
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • BaseNCodecOutputStream

        public BaseNCodecOutputStream​(java.io.OutputStream outputStream,
                                      C basedCodec,
                                      boolean doEncode)
        Constructs 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 Detail

      • close

        public void close()
                   throws java.io.IOException
        Closes this output stream and releases any system resources associated with the stream.

        The underlying stream is closed even if final conversion or flushing fails. If closing also fails, its exception is suppressed on the original exception.

        To write the EOF marker without closing the stream, call eof() or use an Apache Commons IO CloseShieldOutputStream.

        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Overrides:
        close in class java.io.FilterOutputStream
        Throws:
        java.io.IOException - Thrown if an I/O error occurs.
      • eof

        public void eof()
                 throws java.io.IOException
        Notifies the decoder or encoder of EOF (-1).
        Throws:
        java.io.IOException - Thrown when a problem is detected processing data.
        Since:
        1.11
      • 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:
        flush in interface java.io.Flushable
        Overrides:
        flush in class java.io.FilterOutputStream
        Throws:
        java.io.IOException - Thrown if an I/O error occurs.
      • isStrictDecoding

        public boolean isStrictDecoding()
        Tests whether decoding behavior is strict.

        Strict decoding rejects invalid trailing bits and, for Base32 and Base64, noncanonical input. Decoding errors are reported as IOException. To complete validation, call eof() or close(). Decoded bytes can be emitted before a later validation error.

        Returns:
        true if using strict decoding.
        Since:
        1.15
      • write

        public void write​(byte[] array,
                          int offset,
                          int len)
                   throws java.io.IOException
        Writes len bytes from the specified b array starting at offset to this output stream.
        Overrides:
        write in class java.io.FilterOutputStream
        Parameters:
        array - source byte array.
        offset - where to start reading the bytes.
        len - maximum number of bytes to write.
        Throws:
        java.io.IOException - Thrown if an I/O error occurs.
        java.lang.NullPointerException - Thrown if the byte array parameter is null.
        java.lang.IndexOutOfBoundsException - Thrown if the offset, length, or buffer size is invalid.
      • write

        public void write​(int i)
                   throws java.io.IOException
        Writes the specified byte to this output stream.
        Overrides:
        write in class java.io.FilterOutputStream
        Parameters:
        i - source byte.
        Throws:
        java.io.IOException - Thrown if an I/O error occurs.