Class ReadBufferManager

java.lang.Object
org.h2gis.functions.io.utility.ReadBufferManager

public final class ReadBufferManager extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
    Instantiates a ReadBufferManager to read the specified channel
    ReadBufferManager(FileChannel channel, int bufferSize)
    Instantiates a ReadBufferManager to read the specified channel.
  • Method Summary

    Modifier and Type
    Method
    Description
    byte
    get()
    Gets the byte value at the current position
    get(byte[] buffer)
    Gets the byte[] value at the current position
    get(long pos, byte[] buffer)
    Gets the byte[] value at the specified position
    byte
    getByte(long bytePos)
    Gets the byte value at the specified position
    double
    Gets the double value at the specified position
    double
    getDouble(long bytePos)
    Gets the double value at the specified position
    int
    Gets the int value at the current position
    int
    getInt(long bytePos)
    Gets the int value at the specified position
    long
    Gets the size of the channel
    long
    Gets the long value at the current position
    long
    getLong(long bytePos)
    Gets the long value at the specified position
    long
    Gets the positionf of this buffer in the file it's reading.
    boolean
    If the current position is at the end of the channel
    void
    Specifies the byte order.
    void
    position(long position)
    Moves the current position to the specified one
    long
    Gets the number of remaining bytes in the current file, starting from the current position
    void
    skip(int numBytes)
    skips the specified number of bytes from the current position in the channel

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ReadBufferManager

      public ReadBufferManager(FileChannel channel) throws IOException
      Instantiates a ReadBufferManager to read the specified channel
      Parameters:
      channel -
      Throws:
      IOException
    • ReadBufferManager

      public ReadBufferManager(FileChannel channel, int bufferSize) throws IOException
      Instantiates a ReadBufferManager to read the specified channel. The specified bufferSize is the size of the channel content cached in memory
      Parameters:
      channel -
      bufferSize -
      Throws:
      IOException
  • Method Details

    • getByte

      public byte getByte(long bytePos) throws IOException
      Gets the byte value at the specified position
      Parameters:
      bytePos -
      Returns:
      Throws:
      IOException
    • getLength

      public long getLength() throws IOException
      Gets the size of the channel
      Returns:
      Throws:
      IOException
    • order

      public void order(ByteOrder order)
      Specifies the byte order. One of the constants in ByteBuffer
      Parameters:
      order -
    • getInt

      public int getInt(long bytePos) throws IOException
      Gets the int value at the specified position
      Parameters:
      bytePos -
      Returns:
      Throws:
      IOException
    • getLong

      public long getLong(long bytePos) throws IOException
      Gets the long value at the specified position
      Parameters:
      bytePos -
      Returns:
      Throws:
      IOException
    • getLong

      public long getLong() throws IOException
      Gets the long value at the current position
      Returns:
      Throws:
      IOException
    • get

      public byte get() throws IOException
      Gets the byte value at the current position
      Returns:
      Throws:
      IOException
    • getInt

      public int getInt() throws IOException
      Gets the int value at the current position
      Returns:
      Throws:
      IOException
    • skip

      public void skip(int numBytes) throws IOException
      skips the specified number of bytes from the current position in the channel
      Parameters:
      numBytes -
      Throws:
      IOException
    • get

      public ByteBuffer get(byte[] buffer) throws IOException
      Gets the byte[] value at the current position
      Parameters:
      buffer -
      Returns:
      Throws:
      IOException
    • get

      public ByteBuffer get(long pos, byte[] buffer) throws IOException
      Gets the byte[] value at the specified position
      Parameters:
      pos -
      buffer -
      Returns:
      Throws:
      IOException
    • position

      public void position(long position)
      Moves the current position to the specified one
      Parameters:
      position -
    • getPosition

      public long getPosition()
      Gets the positionf of this buffer in the file it's reading.
      Returns:
    • getDouble

      public double getDouble() throws IOException
      Gets the double value at the specified position
      Returns:
      Throws:
      IOException
    • getDouble

      public double getDouble(long bytePos) throws IOException
      Gets the double value at the specified position
      Parameters:
      bytePos -
      Returns:
      Throws:
      IOException
    • isEOF

      public boolean isEOF() throws IOException
      If the current position is at the end of the channel
      Returns:
      Throws:
      IOException
    • remaining

      public long remaining() throws IOException
      Gets the number of remaining bytes in the current file, starting from the current position
      Returns:
      a number of bytes >=0
      Throws:
      IOException