Package org.agrona.io

Class DirectBufferInputStream

java.lang.Object
java.io.InputStream
org.agrona.io.DirectBufferInputStream
All Implemented Interfaces:
Closeable, AutoCloseable

public class DirectBufferInputStream extends InputStream
An InputStream that wraps a DirectBuffer.
  • Field Details

    • buffer

      private DirectBuffer buffer
    • offset

      private int offset
    • length

      private int length
    • position

      private int position
  • Constructor Details

    • DirectBufferInputStream

      public DirectBufferInputStream()
      Default constructor.
    • DirectBufferInputStream

      public DirectBufferInputStream(DirectBuffer buffer)
      Wrap given DirectBuffer.
      Parameters:
      buffer - to wrap.
    • DirectBufferInputStream

      public DirectBufferInputStream(DirectBuffer buffer, int offset, int length)
      Wrap given DirectBuffer.
      Parameters:
      buffer - to wrap.
      offset - into the buffer.
      length - in bytes.
  • Method Details

    • wrap

      public void wrap(DirectBuffer buffer)
      Wrap given DirectBuffer.
      Parameters:
      buffer - to wrap.
    • wrap

      public void wrap(DirectBuffer buffer, int offset, int length)
      Wrap given DirectBuffer.
      Parameters:
      buffer - to wrap.
      offset - into the buffer.
      length - in bytes.
    • offset

      public int offset()
      The offset within the underlying buffer at which to start.
      Returns:
      offset within the underlying buffer at which to start.
    • length

      public int length()
      The length of the underlying buffer to use
      Returns:
      length of the underlying buffer to use
    • buffer

      public DirectBuffer buffer()
      The underlying buffer being wrapped.
      Returns:
      the underlying buffer being wrapped.
    • markSupported

      public boolean markSupported()
      Overrides:
      markSupported in class InputStream
    • available

      public int available()
      Overrides:
      available in class InputStream
    • skip

      public long skip(long n)
      Overrides:
      skip in class InputStream
    • read

      public int read()
      Specified by:
      read in class InputStream
    • read

      public int read(byte[] dstBytes, int dstOffset, int length)
      Overrides:
      read in class InputStream
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Overrides:
      close in class InputStream