Package db
Interface Buffer
- All Known Implementing Classes:
ChainedBuffer,DataBuffer
public interface Buffer
Buffer provides a general purpose storage buffer interface
providing various data access methods.-
Method Summary
ChangeModifier and TypeMethodDescriptionMODIFIEDvoidget(int offset, byte[] bytes) Get the byte data located at the specified offset and store into the bytes array provided.MODIFIEDvoidget(int offset, byte[] data, int dataOffset, int length) Get the byte data located at the specified offset and store into the data array at the specified data offset.MODIFIEDbyte[]get(int offset, int length) Get the byte data located at the specified offset.MODIFIEDbytegetByte(int offset) Get the 8-bit byte value located at the specified offset.intgetId()Get the buffer ID for this buffer.MODIFIEDintgetInt(int offset) Get the 32-bit integer value located at the specified offset.MODIFIEDlonggetLong(int offset) Get the 64-bit long value located at the specified offset.MODIFIEDshortgetShort(int offset) Get the 16-bit short value located at the specified offset.intlength()Get the length of the buffer in bytes.MODIFIEDintput(int offset, byte[] bytes) Put the bytes provided into the buffer at the specified offset.MODIFIEDintput(int offset, byte[] data, int dataOffset, int length) Put a specified number of bytes from the array provided into the buffer at the specified offset.MODIFIEDintputByte(int offset, byte b) Put the 8-bit byte value into the buffer at the specified offset.MODIFIEDintputInt(int offset, int v) Put the 32-bit integer value into the buffer at the specified offset.MODIFIEDintputLong(int offset, long v) Put the 64-bit long value into the buffer at the specified offset.MODIFIEDintputShort(int offset, short v) Put the 16-bit short value into the buffer at the specified offset.
-
Method Details
-
getId
int getId()Get the buffer ID for this buffer.- Returns:
- int
-
length
int length()Get the length of the buffer in bytes. The length reflects the number of bytes which have been allocated to the buffer.- Returns:
- length of allocated buffer.
-
get MODIFIED
added throws IndexOutOfBoundsException-void get(int offset, byte[] bytes) throws IOException+void get(int offset, byte[] bytes) throws IndexOutOfBoundsException, IOExceptionGet the byte data located at the specified offset and store into the bytes array provided.- Parameters:
offset- byte offset from start of buffer.bytes- byte array to store data- Throws:
IndexOutOfBoundsException- is thrown if an invalid offset is specified.IOException- is thrown if an error occurs while accessing the underlying storage.
-
get MODIFIED
void get(int offset, byte[] data, int dataOffset, int length) throws IndexOutOfBoundsException, IOException added throws IndexOutOfBoundsException-void get(int offset, byte[] data, int dataOffset, int length) throws IOException+void get(int offset, byte[] data, int dataOffset, int length) throws IndexOutOfBoundsException, IOExceptionGet the byte data located at the specified offset and store into the data array at the specified data offset.- Parameters:
offset- byte offset from the start of the buffer.data- byte array to store the data.dataOffset- offset into the data bufferlength- amount of data to read- Throws:
IndexOutOfBoundsException- if an invalid offset, dataOffset, or length is specified.IOException- is thrown if an error occurs while accessing the underlying storage.
-
get MODIFIED
added throws IndexOutOfBoundsException-byte[] get(int offset, int length) throws IOException+byte[] get(int offset, int length) throws IndexOutOfBoundsException, IOExceptionGet the byte data located at the specified offset.- Parameters:
offset- byte offset from start of buffer.length- number of bytes to be read and returned- Returns:
- the byte array.
- Throws:
IndexOutOfBoundsException- is thrown if an invalid offset is specified or the end of the buffer was encountered while reading the data.IOException- is thrown if an error occurs while accessing the underlying storage.
-
getByte MODIFIED
added throws IndexOutOfBoundsException-byte getByte(int offset) throws IOException+byte getByte(int offset) throws IndexOutOfBoundsException, IOExceptionGet the 8-bit byte value located at the specified offset.- Parameters:
offset- byte offset from start of buffer.- Returns:
- the byte value at the specified offset.
- Throws:
IndexOutOfBoundsException- is thrown if an invalid offset is specified.IOException- is thrown if an error occurs while accessing the underlying storage.
-
getInt MODIFIED
added throws IndexOutOfBoundsException-int getInt(int offset) throws IOException+int getInt(int offset) throws IndexOutOfBoundsException, IOExceptionGet the 32-bit integer value located at the specified offset.- Parameters:
offset- byte offset from start of buffer.- Returns:
- the integer value at the specified offset.
- Throws:
IndexOutOfBoundsException- is thrown if an invalid offset is specified or the end of the buffer was encountered while reading the value.IOException- is thrown if an error occurs while accessing the underlying storage.
-
getShort MODIFIED
added throws IndexOutOfBoundsException-short getShort(int offset) throws IOException+short getShort(int offset) throws IndexOutOfBoundsException, IOExceptionGet the 16-bit short value located at the specified offset.- Parameters:
offset- byte offset from start of buffer.- Returns:
- the short value at the specified offset.
- Throws:
IndexOutOfBoundsException- is thrown if an invalid offset is specified or the end of the buffer was encountered while reading the value.IOException- is thrown if an error occurs while accessing the underlying storage.
-
getLong MODIFIED
added throws IndexOutOfBoundsException-long getLong(int offset) throws IOException+long getLong(int offset) throws IndexOutOfBoundsException, IOExceptionGet the 64-bit long value located at the specified offset.- Parameters:
offset- byte offset from start of buffer.- Returns:
- the long value at the specified offset.
- Throws:
IndexOutOfBoundsException- is thrown if an invalid offset is specified or the end of the buffer was encountered while reading the value.IOException- is thrown if an error occurs while accessing the underlying storage.
-
put MODIFIED
int put(int offset, byte[] data, int dataOffset, int length) throws IndexOutOfBoundsException, IOException added throws IndexOutOfBoundsException-int put(int offset, byte[] data, int dataOffset, int length) throws IOException+int put(int offset, byte[] data, int dataOffset, int length) throws IndexOutOfBoundsException, IOExceptionPut a specified number of bytes from the array provided into the buffer at the specified offset. The number of bytes stored is specified by the length specified.- Parameters:
offset- byte offset from start of buffer.data- the byte data to be stored.dataOffset- the starting offset into the data.length- the number of bytes to be stored.- Returns:
- the next available offset into the buffer, or -1 if the buffer is full.
- Throws:
IndexOutOfBoundsException- if an invalid offset is provided or the end of buffer was encountered while storing the data.IOException- is thrown if an error occurs while accessing the underlying storage.
-
put MODIFIED
added throws IndexOutOfBoundsException-int put(int offset, byte[] bytes) throws IOException+int put(int offset, byte[] bytes) throws IndexOutOfBoundsException, IOExceptionPut the bytes provided into the buffer at the specified offset. The number of bytes stored is determined by the length of the bytes array.- Parameters:
offset- byte offset from start of buffer.bytes- the byte data to be stored.- Returns:
- the next available offset into the buffer, or -1 if the buffer is full.
- Throws:
IndexOutOfBoundsException- if an invalid offset is provided or the end of buffer was encountered while storing the data.IOException- is thrown if an error occurs while accessing the underlying storage.
-
putByte MODIFIED
added throws IndexOutOfBoundsException-int putByte(int offset, byte b) throws IOException+int putByte(int offset, byte b) throws IndexOutOfBoundsException, IOExceptionPut the 8-bit byte value into the buffer at the specified offset.- Parameters:
offset- byte offset from start of buffer.b- the byte value to be stored.- Returns:
- the next available offset into the buffer, or -1 if the buffer is full.
- Throws:
IndexOutOfBoundsException- if an invalid offset is provided.IOException- is thrown if an error occurs while accessing the underlying storage.
-
putInt MODIFIED
added throws IndexOutOfBoundsException-int putInt(int offset, int v) throws IOException+int putInt(int offset, int v) throws IndexOutOfBoundsException, IOExceptionPut the 32-bit integer value into the buffer at the specified offset.- Parameters:
offset- byte offset from start of buffer.v- the integer value to be stored.- Returns:
- the next available offset into the buffer, or -1 if the buffer is full.
- Throws:
IndexOutOfBoundsException- if an invalid offset is provided or the end of buffer was encountered while storing the data.IOException- is thrown if an error occurs while accessing the underlying storage.
-
putShort MODIFIED
added throws IndexOutOfBoundsException-int putShort(int offset, short v) throws IOException+int putShort(int offset, short v) throws IndexOutOfBoundsException, IOExceptionPut the 16-bit short value into the buffer at the specified offset.- Parameters:
offset- byte offset from start of buffer.v- the short value to be stored.- Returns:
- the next available offset into the buffer, or -1 if the buffer is full.
- Throws:
IndexOutOfBoundsException- if an invalid offset is provided or the end of buffer was encountered while storing the data.IOException- is thrown if an error occurs while accessing the underlying storage.
-
putLong MODIFIED
added throws IndexOutOfBoundsException-int putLong(int offset, long v) throws IOException+int putLong(int offset, long v) throws IndexOutOfBoundsException, IOExceptionPut the 64-bit long value into the buffer at the specified offset.- Parameters:
offset- byte offset from start of buffer.v- the long value to be stored.- Returns:
- the next available offset into the buffer, or -1 if the buffer is full.
- Throws:
IndexOutOfBoundsException- if an invalid offset is provided or the end of buffer was encountered while storing the data.IOException- is thrown if an error occurs while accessing the underlying storage.
-