public class MemoryStoreBuffer extends java.lang.Object implements BlockPublishStore.Buffer
Modifier and Type | Field and Description |
---|---|
protected java.nio.ByteBuffer |
_buffer |
protected Store |
_store |
Constructor and Description |
---|
MemoryStoreBuffer() |
Modifier and Type | Method and Description |
---|---|
void |
close() |
byte |
getByte()
Gets the byte from the buffer.
|
void |
getBytes(BlockPublishStore.ByteSequence outBytes)
Gets the series of bytes at the current position by placing them into the provided
BlockPublishStore.ByteSequence object. |
void |
getBytes(Field outField,
int length)
Gets the series of bytes at the current position, this is done by copying them into a
Field
object. |
int |
getInt()
Gets the integer from the buffer.
|
int |
getInt(long position)
Gets the integer from the buffer.
|
long |
getLong()
Gets the long from the buffer.
|
long |
getPosition()
Gets the current position in the buffer.
|
long |
getSize()
Gets the size of the buffer.
|
void |
putByte(byte b)
Writes the byte in the buffer.
|
void |
putBytes(BlockPublishStore.ByteSequence bytes)
Writes a series of bytes at the current position, taken from the specified
BlockPublishStore.ByteSequence . |
void |
putBytes(byte[] buffer,
long position,
long length)
Writes a series of bytes at the current position, taken from a byte array.
|
void |
putInt(int i)
Writes the integer into the buffer.
|
void |
putInt(long position,
int i)
Writes the integer into the buffer.
|
void |
putLong(long l)
Writes the long to the buffer.
|
void |
putLong(long position,
long l)
Writes the long to the buffer.
|
void |
setPosition(long position)
Sets the new current position in the buffer.
|
void |
setSize(long newSize)
Sets the size of the buffer.
|
void |
zero(long offset,
int length)
Sets the offset and length of the buffer to 0.
|
protected java.nio.ByteBuffer _buffer
protected Store _store
public long getSize() throws java.io.IOException
getSize
in interface BlockPublishStore.Buffer
java.io.IOException
- Not thrown from this implementationpublic void setSize(long newSize) throws java.io.IOException
setSize
in interface BlockPublishStore.Buffer
newSize
- The new size to be assigned to the buffer.java.io.IOException
- Not thrown from this implementationpublic long getPosition() throws java.io.IOException
getPosition
in interface BlockPublishStore.Buffer
java.io.IOException
- Not thrown from this implementationpublic void setPosition(long position) throws java.io.IOException
setPosition
in interface BlockPublishStore.Buffer
position
- The new current position to be set in the buffer.java.io.IOException
- Not thrown from this implementationpublic void putByte(byte b) throws java.io.IOException
putByte
in interface BlockPublishStore.Buffer
b
- The byte to be written in the buffer.java.io.IOException
- Not thrown from this implementationpublic byte getByte() throws java.io.IOException
getByte
in interface BlockPublishStore.Buffer
java.io.IOException
- Not thrown from this implementationpublic void putInt(int i) throws java.io.IOException
putInt
in interface BlockPublishStore.Buffer
i
- Integer to be placed in the buffer.java.io.IOException
- Not thrown from this implementationpublic void putInt(long position, int i) throws java.io.IOException
putInt
in interface BlockPublishStore.Buffer
position
- The location where the integer is placed in the buffer.i
- Integer to be placed in the buffer.java.io.IOException
- Not thrown from this implementationpublic int getInt() throws java.io.IOException
getInt
in interface BlockPublishStore.Buffer
java.io.IOException
- Not thrown from this implementationpublic int getInt(long position) throws java.io.IOException
getInt
in interface BlockPublishStore.Buffer
position
- The position in the buffer where the integer begins.java.io.IOException
- Not thrown from this implementationpublic void putLong(long l) throws java.io.IOException
putLong
in interface BlockPublishStore.Buffer
l
- The long to write to the buffer.java.io.IOException
- Not thrown from this implementationpublic void putLong(long position, long l) throws java.io.IOException
putLong
in interface BlockPublishStore.Buffer
position
- The position in the buffer where the long should be placed.l
- The long to write in the buffer.java.io.IOException
- Not thrown from this implementationpublic long getLong() throws java.io.IOException
getLong
in interface BlockPublishStore.Buffer
java.io.IOException
- Not thrown from this implementationpublic void putBytes(BlockPublishStore.ByteSequence bytes) throws java.io.IOException
BlockPublishStore.ByteSequence
.putBytes
in interface BlockPublishStore.Buffer
bytes
- The series of bytes to write at the current position.java.io.IOException
- Not thrown from this implementationpublic void getBytes(BlockPublishStore.ByteSequence outBytes) throws java.io.IOException
BlockPublishStore.ByteSequence
object.getBytes
in interface BlockPublishStore.Buffer
outBytes
- The ByteSequence object to be copied.java.io.IOException
- Not thrown from this implementationpublic void putBytes(byte[] buffer, long position, long length) throws java.io.IOException
putBytes
in interface BlockPublishStore.Buffer
buffer
- The buffer containing a series of bytes.position
- The position in the buffer where the series of bytes are located.length
- The length of the byte buffer.java.io.IOException
- Not thrown from this implementationpublic void getBytes(Field outField, int length) throws java.io.IOException
Field
object.getBytes
in interface BlockPublishStore.Buffer
outField
- The Field object used to copy the byte sequence.length
- The length of the Field object.java.io.IOException
- Not thrown from this implementationpublic void zero(long offset, int length) throws java.io.IOException
zero
in interface BlockPublishStore.Buffer
offset
- The offset to set as 0.length
- The length to set as 0.java.io.IOException
- Not thrown from this implementationpublic void close() throws java.lang.Exception
close
in interface java.lang.AutoCloseable
java.lang.Exception