public static class BufferFacadeFactory.ByteBufferFacade extends Object implements BufferFacade
ByteBuffer.| Constructor and Description |
|---|
ByteBufferFacade(ByteBuffer buf) |
ByteBufferFacade(ByteBuffer buf,
int base) |
| Modifier and Type | Method and Description |
|---|---|
long |
capacity()
Returns the capacity of the wrapped buffer.
|
byte |
get(long index)
Returns the single byte at the specified index (relative to the
relocation base).
|
byte[] |
getBytes(long index,
int len)
Returns an array containing the
len bytes starting
at the specified index (relative to the relocation base). |
char |
getChar(long index)
Returns the 2-byte
char value at the specified index
(relative to the relocation base). |
double |
getDouble(long index)
Returns the 8-byte
double value at the specified index
(relative to the relocation base). |
float |
getFloat(long index)
Returns the 4-byte
float value at the specified index
(relative to the relocation base). |
int |
getInt(long index)
Returns the 4-byte
int value at the specified index
(relative to the relocation base). |
long |
getLong(long index)
Returns the 8-byte
long value at the specified index
(relative to the relocation base). |
short |
getShort(long index)
Returns the 2-byte
short value at the specified index
(relative to the relocation base). |
long |
limit()
Returns the limit of the buffer: the highest legal index + 1.
|
void |
put(long index,
byte value)
Updates the single byte at the specified index (relative to the
relocation base).
|
void |
putBytes(long index,
byte[] value)
Inserts the specified array into the buffer, starting at the given
index (relative to the relocation base).
|
void |
putChar(long index,
char value)
Sets the 2-byte
char value at the specified index
(relative to the relocation base). |
void |
putDouble(long index,
double value)
Sets the 8-byte
double value at the specified index
(relative to the relocation base). |
void |
putFloat(long index,
float value)
Sets the 4-byte
float value at the specified index
(relative to the relocation base). |
void |
putInt(long index,
int value)
Sets the 4-byte
int value at the specified index
(relative to the relocation base). |
void |
putLong(long index,
long value)
Sets the 8-byte
long value at the specified index
(relative to the relocation base). |
void |
putShort(long index,
short value)
Sets the 2-byte
short value at the specified index
(relative to the relocation base). |
ByteBuffer |
slice(long index)
Returns a
ByteBuffer that represents a slice of the
underlying buffer (ie, shares the same backing store), starting at
the given index (relative to the relocation base) and extending to
the end of the underlying buffer. |
public ByteBufferFacade(ByteBuffer buf)
public ByteBufferFacade(ByteBuffer buf, int base)
public byte get(long index)
BufferFacadeget in interface BufferFacadepublic void put(long index,
byte value)
BufferFacadeput in interface BufferFacadepublic short getShort(long index)
BufferFacadeshort value at the specified index
(relative to the relocation base).getShort in interface BufferFacadepublic void putShort(long index,
short value)
BufferFacadeshort value at the specified index
(relative to the relocation base).putShort in interface BufferFacadepublic int getInt(long index)
BufferFacadeint value at the specified index
(relative to the relocation base).getInt in interface BufferFacadepublic void putInt(long index,
int value)
BufferFacadeint value at the specified index
(relative to the relocation base).putInt in interface BufferFacadepublic long getLong(long index)
BufferFacadelong value at the specified index
(relative to the relocation base).getLong in interface BufferFacadepublic void putLong(long index,
long value)
BufferFacadelong value at the specified index
(relative to the relocation base).putLong in interface BufferFacadepublic float getFloat(long index)
BufferFacadefloat value at the specified index
(relative to the relocation base).getFloat in interface BufferFacadepublic void putFloat(long index,
float value)
BufferFacadefloat value at the specified index
(relative to the relocation base).putFloat in interface BufferFacadepublic double getDouble(long index)
BufferFacadedouble value at the specified index
(relative to the relocation base).getDouble in interface BufferFacadepublic void putDouble(long index,
double value)
BufferFacadedouble value at the specified index
(relative to the relocation base).putDouble in interface BufferFacadepublic char getChar(long index)
BufferFacadechar value at the specified index
(relative to the relocation base).getChar in interface BufferFacadepublic void putChar(long index,
char value)
BufferFacadechar value at the specified index
(relative to the relocation base).putChar in interface BufferFacadepublic byte[] getBytes(long index,
int len)
BufferFacadelen bytes starting
at the specified index (relative to the relocation base).getBytes in interface BufferFacadepublic void putBytes(long index,
byte[] value)
BufferFacadeputBytes in interface BufferFacadepublic ByteBuffer slice(long index)
BufferFacadeByteBuffer that represents a slice of the
underlying buffer (ie, shares the same backing store), starting at
the given index (relative to the relocation base) and extending to
the end of the underlying buffer.
The semantics of this method depend on the underlying buffer. For a
normal ByteBuffer, the limit will be determined by the
size of the original buffer. For a MappedFileBuffer,
the limit will depend on the particular segment containing the offset.
slice in interface BufferFacadepublic long capacity()
BufferFacadecapacity in interface BufferFacadepublic long limit()
BufferFacadeBufferFacade.capacity().
Support for this method will depend on the underlying buffer's support
for limits. MappedFileBuffer does not support limits, and will
always return capacity. The non-threadsafe facade created by BufferFacadeFactory does support limits, but the threadsafe facade
only supports limits that were set before the first facade method
was invoked (because it clones the buffer).
limit in interface BufferFacade