Package org.h2gis.functions.io.utility
Class ReadBufferManager
java.lang.Object
org.h2gis.functions.io.utility.ReadBufferManager
-
Constructor Summary
ConstructorsConstructorDescriptionReadBufferManager(FileChannel channel) Instantiates a ReadBufferManager to read the specified channelReadBufferManager(FileChannel channel, int bufferSize) Instantiates a ReadBufferManager to read the specified channel. -
Method Summary
Modifier and TypeMethodDescriptionbyteget()Gets the byte value at the current positionget(byte[] buffer) Gets the byte[] value at the current positionget(long pos, byte[] buffer) Gets the byte[] value at the specified positionbytegetByte(long bytePos) Gets the byte value at the specified positiondoubleGets the double value at the specified positiondoublegetDouble(long bytePos) Gets the double value at the specified positionintgetInt()Gets the int value at the current positionintgetInt(long bytePos) Gets the int value at the specified positionlongGets the size of the channellonggetLong()Gets the long value at the current positionlonggetLong(long bytePos) Gets the long value at the specified positionlongGets the positionf of this buffer in the file it's reading.booleanisEOF()If the current position is at the end of the channelvoidSpecifies the byte order.voidposition(long position) Moves the current position to the specified onelongGets the number of remaining bytes in the current file, starting from the current positionvoidskip(int numBytes) skips the specified number of bytes from the current position in the channel
-
Constructor Details
-
ReadBufferManager
Instantiates a ReadBufferManager to read the specified channel- Parameters:
channel-- Throws:
IOException
-
ReadBufferManager
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
Gets the byte value at the specified position- Parameters:
bytePos-- Returns:
- Throws:
IOException
-
getLength
Gets the size of the channel- Returns:
- Throws:
IOException
-
order
Specifies the byte order. One of the constants inByteBuffer- Parameters:
order-
-
getInt
Gets the int value at the specified position- Parameters:
bytePos-- Returns:
- Throws:
IOException
-
getLong
Gets the long value at the specified position- Parameters:
bytePos-- Returns:
- Throws:
IOException
-
getLong
Gets the long value at the current position- Returns:
- Throws:
IOException
-
get
Gets the byte value at the current position- Returns:
- Throws:
IOException
-
getInt
Gets the int value at the current position- Returns:
- Throws:
IOException
-
skip
skips the specified number of bytes from the current position in the channel- Parameters:
numBytes-- Throws:
IOException
-
get
Gets the byte[] value at the current position- Parameters:
buffer-- Returns:
- Throws:
IOException
-
get
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
Gets the double value at the specified position- Returns:
- Throws:
IOException
-
getDouble
Gets the double value at the specified position- Parameters:
bytePos-- Returns:
- Throws:
IOException
-
isEOF
If the current position is at the end of the channel- Returns:
- Throws:
IOException
-
remaining
Gets the number of remaining bytes in the current file, starting from the current position- Returns:
- a number of bytes >=0
- Throws:
IOException
-