Class EncoderStream

  • All Implemented Interfaces:
    java.io.Closeable, java.io.Flushable, java.lang.AutoCloseable

    public final class EncoderStream
    extends java.io.FilterOutputStream
    An OutputStream that provides on-the-fly encoding to an underlying stream.
    Version:
    $Id: //depot/branches/personal/haraldk/twelvemonkeys/release-2/twelvemonkeys-core/src/main/java/com/twelvemonkeys/io/enc/EncoderStream.java#2 $
    Author:
    Harald Kuhr
    See Also:
    DecoderStream, Encoder
    • Field Summary

      • Fields inherited from class java.io.FilterOutputStream

        out
    • Constructor Summary

      Constructors 
      Constructor Description
      EncoderStream​(java.io.OutputStream stream, Encoder encoder)
      Creates an output stream filter built on top of the specified underlying output stream.
      EncoderStream​(java.io.OutputStream stream, Encoder encoder, boolean flushOnWrite)
      Creates an output stream filter built on top of the specified underlying output stream.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()  
      void flush()  
      void write​(byte[] bytes)  
      void write​(byte[] values, int offset, int length)  
      void write​(int value)  
      • 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

      • EncoderStream

        public EncoderStream​(java.io.OutputStream stream,
                             Encoder encoder)
        Creates an output stream filter built on top of the specified underlying output stream.
        Parameters:
        stream - the underlying output stream
        encoder - the encoder to use
      • EncoderStream

        public EncoderStream​(java.io.OutputStream stream,
                             Encoder encoder,
                             boolean flushOnWrite)
        Creates an output stream filter built on top of the specified underlying output stream.
        Parameters:
        stream - the underlying output stream
        encoder - the encoder to use
        flushOnWrite - if true, calls to the byte-array write methods will automatically flush the buffer.
    • Method Detail

      • close

        public void close()
                   throws java.io.IOException
        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
      • flush

        public void flush()
                   throws java.io.IOException
        Specified by:
        flush in interface java.io.Flushable
        Overrides:
        flush in class java.io.FilterOutputStream
        Throws:
        java.io.IOException
      • write

        public void write​(byte[] bytes)
                   throws java.io.IOException
        Overrides:
        write in class java.io.FilterOutputStream
        Throws:
        java.io.IOException
      • write

        public void write​(byte[] values,
                          int offset,
                          int length)
                   throws java.io.IOException
        Overrides:
        write in class java.io.FilterOutputStream
        Throws:
        java.io.IOException
      • write

        public void write​(int value)
                   throws java.io.IOException
        Overrides:
        write in class java.io.FilterOutputStream
        Throws:
        java.io.IOException