Class ReadableSourceOverByteBuffer

java.lang.Object
org.aksw.commons.io.input.ReadableSourceOverByteBuffer
All Implemented Interfaces:
HasArrayOps<byte[]>, ReadableSource<byte[]>

public class ReadableSourceOverByteBuffer extends Object implements ReadableSource<byte[]>
  • Field Details

    • byteBuffer

      protected ByteBuffer byteBuffer
    • index

      protected int index
  • Constructor Details

    • ReadableSourceOverByteBuffer

      public ReadableSourceOverByteBuffer(ByteBuffer byteBuffer, int index)
  • Method Details

    • getArrayOps

      public ArrayOps<byte[]> getArrayOps()
      Specified by:
      getArrayOps in interface HasArrayOps<byte[]>
    • read

      public int read(byte[] array, int position, int length) throws IOException
      Description copied from interface: ReadableSource
      Read method following the usual InputStream protocol.
      Specified by:
      read in interface ReadableSource<byte[]>
      Parameters:
      array - The array into which to put the read data
      position - Offset into array where to start writing
      length - Maximum number of items to read.
      Returns:
      The number of items read. Return -1 if end of data was reached, and 0 iff length was 0.
      Throws:
      IOException