Package org.agrona.io

Class DirectBufferInputStream

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

    public class DirectBufferInputStream
    extends java.io.InputStream
    An InputStream that wraps a DirectBuffer.
    • Field Detail

      • offset

        private int offset
      • length

        private int length
      • position

        private int position
    • Constructor Detail

      • 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 Detail

      • 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 java.io.InputStream
      • available

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

        public long skip​(long n)
        Overrides:
        skip in class java.io.InputStream
      • read

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

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

        public void close()
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Overrides:
        close in class java.io.InputStream