|
SRJRCFrames v0.1.296 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object de.schwarzrot.data.support.OffsetBuffer
public class OffsetBuffer
is a buffer implementation, that can be used as a record base to interpret
binary data from an arbitrary byte-buffer. This buffer can be put anywhere at
the byte-buffer and (opposed to the java standard class ByteBuffer
)
it does not care about data, that is before offset or after offset+size - so
it can be used as a little viewport to a huge byte-buffer.
The OffsetBuffer
can be moved over the arbitrary byte-buffer just by
changing the offset and the position of the getters and setters are relative
to the new offset - and so transparent to the user.
Neither the size
, nor the abitrary byte-buffer can be changed.
All methods, that normally don't return a value return the instance to relax chaining of commands.
Constructor Summary | |
---|---|
OffsetBuffer(byte[] buf,
int offset,
int size)
|
Method Summary | |
---|---|
protected int |
checkPos(int pos)
|
int |
get(int pos)
|
int |
get3ByteInt(int pos)
|
byte[] |
getBytes(int pos,
int size)
|
int |
getInt(int pos)
|
int |
getShort(int pos)
|
int |
offset()
|
OffsetBuffer |
offset(int newOffset)
moves the record (in arbitrary byte buffer) to interpret a different buffer portion as the same record. |
ByteOrder |
order()
|
OffsetBuffer |
order(ByteOrder order)
|
OffsetBuffer |
put(int pos,
byte value)
|
OffsetBuffer |
put3ByteInt(int pos,
int value)
|
OffsetBuffer |
putBytes(int pos,
byte[] content)
|
OffsetBuffer |
putInt(int pos,
int value)
|
OffsetBuffer |
putShort(int pos,
short value)
|
int |
rel2abs(int pos)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public OffsetBuffer(byte[] buf, int offset, int size)
Method Detail |
---|
public final int get(int pos)
public final int get3ByteInt(int pos)
public final byte[] getBytes(int pos, int size)
public final int getInt(int pos)
public final int getShort(int pos)
public final int offset()
public final OffsetBuffer offset(int newOffset)
newOffset
- new start position of the record (from arbitrary byte buffer)
this buffer is base of.
OffsetBuffer
, that has been moved to
the new offset.public final ByteOrder order()
public final OffsetBuffer order(ByteOrder order)
public final OffsetBuffer put(int pos, byte value)
public final OffsetBuffer put3ByteInt(int pos, int value)
public final OffsetBuffer putBytes(int pos, byte[] content)
public final OffsetBuffer putInt(int pos, int value)
public final OffsetBuffer putShort(int pos, short value)
public final int rel2abs(int pos)
protected final int checkPos(int pos)
|
SRJRCFrames v0.1.296 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |