Class ByteBufferInputStream

java.lang.Object
java.io.InputStream
com.jogamp.common.nio.ByteBufferInputStream
All Implemented Interfaces:
Closeable, AutoCloseable

public class ByteBufferInputStream extends InputStream
An InputStream implementation based on an underlying ByteBuffer supporting mark.

May be utilized as well with a memory-mapped FileChannel using a size ≤ Integer.MAX_VALUE.
This becomes efficient with files ≥ 10 MiB, depending on the platform and whether the traditional method uses a BufferedInputStream supporting mark incl. it's buffer size.
See test case com.jogamp.common.nio.TestByteBufferInputStream.

Since:
2.3.0
  • Constructor Details

    • ByteBufferInputStream

      public ByteBufferInputStream(ByteBuffer buf)
      Creates a new byte-buffer input stream.
      Parameters:
      buf - the underlying byte buffer.
  • Method Details