Class ByteBufferOutputStream

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

    public class ByteBufferOutputStream
    extends java.io.OutputStream
    Bridge between the byte buffer and stream worlds.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.nio.ByteBuffer buffer  
      private java.nio.channels.WritableByteChannel channel  
    • Constructor Summary

      Constructors 
      Constructor Description
      ByteBufferOutputStream​(java.nio.channels.WritableByteChannel channel, java.nio.ByteBuffer buffer)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static void drain​(java.nio.channels.WritableByteChannel channel, java.nio.ByteBuffer buffer)  
      void flush()  
      void write​(int b)  
      • Methods inherited from class java.io.OutputStream

        close, nullOutputStream, write, write
      • Methods inherited from class java.lang.Object

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

      • channel

        private final java.nio.channels.WritableByteChannel channel
      • buffer

        private final java.nio.ByteBuffer buffer
    • Constructor Detail

      • ByteBufferOutputStream

        public ByteBufferOutputStream​(java.nio.channels.WritableByteChannel channel,
                                      java.nio.ByteBuffer buffer)
    • Method Detail

      • write

        public void write​(int b)
                   throws java.io.IOException
        Specified by:
        write in class java.io.OutputStream
        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.OutputStream
        Throws:
        java.io.IOException
      • drain

        public static void drain​(java.nio.channels.WritableByteChannel channel,
                                 java.nio.ByteBuffer buffer)
                          throws java.io.IOException
        Throws:
        java.io.IOException