|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.groovemanager.spi.asio.DoubleHalfBuffer
class DoubleHalfBuffer
This class can be used to concatenate two ByteBuffers into one. Since java.nio.ByteBuffer cannot be subclassed from outside the package, this class copies the most important methods from ByteBuffer.
ByteBuffer
Field Summary | |
---|---|
private int |
capacity
This buffer´s capacity |
private ByteBuffer |
firstBuffer
The first buffer |
private int |
firstLimit
The first buffer´s limit |
private int |
limit
This buffer´s current limit |
private int |
position
This buffer´s current limit |
private boolean |
readOnly
Indicates whether this buffer is readOnly or not |
private ByteBuffer |
secondBuffer
The first buffer |
Constructor Summary | |
---|---|
DoubleHalfBuffer(ByteBuffer first,
ByteBuffer second)
Create a new DoubleHalfBuffer out of the given buffers that will be read only if, and only if at least one of the given buffers is read only |
|
DoubleHalfBuffer(ByteBuffer first,
ByteBuffer second,
boolean readOnly)
Create a new DoubleHalfBuffer out of the given buffers |
Method Summary | |
---|---|
DoubleHalfBuffer |
asReadOnlyBuffer()
Creates a new, read-only buffer that shares this buffer's content. |
int |
capacity()
Get his buffer´s total capacity |
DoubleHalfBuffer |
clear()
Clear this buffer by resetting its position to zero and its limit to its capacity. |
DoubleHalfBuffer |
duplicate()
Creates a new buffer that shares this buffer's content. |
DoubleHalfBuffer |
flip()
Flips this buffer. |
byte |
get()
Relative get method. |
DoubleHalfBuffer |
get(byte[] dst)
Relative bulk get method. |
DoubleHalfBuffer |
get(byte[] dst,
int offset,
int length)
Relative bulk get method. |
byte |
get(int position)
Absolute get method. |
boolean |
hasRemaining()
Tells whether there are any elements between the current position and the limit. |
boolean |
isReadOnly()
Tells whether this buffer is read-only or not. |
int |
limit()
Get this buffer´s current limit |
DoubleHalfBuffer |
limit(int limit)
Set this buffer´s limit |
int |
position()
Get his buffer´s current position |
DoubleHalfBuffer |
position(int pos)
Set this buffer´s position |
DoubleHalfBuffer |
put(byte value)
Relative put method. |
DoubleHalfBuffer |
put(byte[] src)
Relative bulk put method. |
DoubleHalfBuffer |
put(byte[] src,
int offset,
int length)
Relative bulk put method. |
DoubleHalfBuffer |
put(int position,
byte value)
Absolute put method. |
int |
remaining()
Get the number of bytes remaining between this buffer´s current position and its limit |
DoubleHalfBuffer |
rewind()
Set this buffer´s position to zero |
DoubleHalfBuffer |
slice()
Creates a new buffer whose content is a shared subsequence of this buffer's content. |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private final ByteBuffer firstBuffer
private final ByteBuffer secondBuffer
private boolean readOnly
private int limit
private int position
private final int capacity
private final int firstLimit
Constructor Detail |
---|
public DoubleHalfBuffer(ByteBuffer first, ByteBuffer second, boolean readOnly)
first
- The first buffersecond
- The second bufferreadOnly
- true, if the resulting buffer should be read only,
false otherwisepublic DoubleHalfBuffer(ByteBuffer first, ByteBuffer second)
first
- The first buffersecond
- The second bufferMethod Detail |
---|
public DoubleHalfBuffer asReadOnlyBuffer()
ByteBuffer.asReadOnlyBuffer()
public DoubleHalfBuffer duplicate()
ByteBuffer.duplicate()
public byte get(int position)
position
- The position fromo which the byte will be read
ByteBuffer.get(int)
public byte get()
ByteBuffer.get()
public DoubleHalfBuffer get(byte[] dst)
src.get(a)
behaves in exactly the same way as the
invocation of src.get(a, 0, a.length)
.
dst
- The destination array to transfer the data to
public DoubleHalfBuffer get(byte[] dst, int offset, int length)
length
bytes
from this buffer into the given destination array starting at
offset
.
dst
- The destination array to transfer the data tooffset
- The offset within the array of the first byte to be
written; must be non-negative and no larger than dst.length
public DoubleHalfBuffer put(int position, byte value)
position
- The position at which the byte will be writtenvalue
- The byte value to be written
public DoubleHalfBuffer put(byte value)
value
- The byte to be written
public DoubleHalfBuffer put(byte[] src)
dst.put(a)
behaves in exactly the same way as the invocation
dst.put(a, 0, a.length)
.
src
- The array to copy the data from
public DoubleHalfBuffer put(byte[] src, int offset, int length)
length
bytes
from the given array starting at offset
to this buffer
starting at the current position.
src
- The array to copy the data fromoffset
- Start position inside the given arraylength
- Number of bytes to put.
public DoubleHalfBuffer slice()
public int capacity()
public DoubleHalfBuffer clear()
public DoubleHalfBuffer flip()
public boolean hasRemaining()
public boolean isReadOnly()
public int limit()
public DoubleHalfBuffer limit(int limit)
limit
- The new limit
public int position()
public DoubleHalfBuffer position(int pos)
pos
- The new position
public int remaining()
public DoubleHalfBuffer rewind()
public String toString()
toString
in class Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |