Package zombie.util

Class ByteBufferOutputStream

java.lang.Object
java.io.OutputStream
zombie.util.ByteBufferOutputStream
All Implemented Interfaces:
Closeable, Flushable, AutoCloseable

public class ByteBufferOutputStream extends OutputStream
Wraps a ByteBuffer so it can be used like an OutputStream. This is similar to a ByteArrayOutputStream, just that this uses a ByteBuffer instead of a byte[] as internal storage.
  • Constructor Details

    • ByteBufferOutputStream

      public ByteBufferOutputStream(ByteBuffer wrappedBuffer, boolean autoEnlarge)
  • Method Details

    • toByteBuffer

      public ByteBuffer toByteBuffer()
    • getWrappedBuffer

      public ByteBuffer getWrappedBuffer()
    • clear

      public void clear()
    • flip

      public void flip()
    • write

      public void write(int bty)
      Specified by:
      write in class OutputStream
    • write

      public void write(byte[] bytes)
      Overrides:
      write in class OutputStream
    • write

      public void write(byte[] bytes, int off, int len)
      Overrides:
      write in class OutputStream