|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.rej.util.ByteArrayByteParser
public class ByteArrayByteParser
Class that wraps a byte array and offers tools for reading the array.
Constructor Summary | |
---|---|
ByteArrayByteParser(byte[] data)
Initializes this parser with the given byte array, starting the parsing from the beginning of the array. |
|
ByteArrayByteParser(byte[] data,
int pos)
Initializes this parse with the given byte array, starting the parsing from the position indicated by the parameter pos . |
Method Summary | |
---|---|
byte |
getByte()
Returns the next byte available. |
int |
getByteAsInt()
Returns the next unsigned byte available as an int . |
byte[] |
getBytes(int count)
Returns an array of the next count bytes. |
long |
getInt()
Returns the unsigned value of the next 4 bytes as a long . |
ByteParser |
getNewParser()
Deprecated. |
int |
getPosition()
Returns the current position of this parser. |
int |
getShortAsInt()
Returns the unsigned value of the next two bytes available in the parser as an int . |
boolean |
hasMore()
Returns true if the end of the underlying data source has not been reached yet. |
int |
peekByte()
Returns an unsigned value of the next byte in this parser, without advancing the position of the parser. |
void |
setBigEndian(boolean bigEndian)
Sets the big-endian mode of this parser. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ByteArrayByteParser(byte[] data)
data
- a byte array to parse.public ByteArrayByteParser(byte[] data, int pos)
pos
.
data
- a byte array to parse.pos
- the position to start parsing from.Method Detail |
---|
public byte getByte()
ByteParser
getByte
in interface ByteParser
public byte[] getBytes(int count)
ByteParser
count
bytes.
getBytes
in interface ByteParser
count
- the number of bytes to read.
public int getByteAsInt()
ByteParser
int
.
getByteAsInt
in interface ByteParser
public int getShortAsInt()
ByteParser
int
.
getShortAsInt
in interface ByteParser
public long getInt()
ByteParser
long
.
getInt
in interface ByteParser
@Deprecated public ByteParser getNewParser()
ByteParser
getNewParser
in interface ByteParser
public void setBigEndian(boolean bigEndian)
ByteParser
setBigEndian
in interface ByteParser
bigEndian
- a boolean value true for big-endian mode, false
for non-big-endian mode.public boolean hasMore()
ByteParser
hasMore
in interface ByteParser
public int getPosition()
ByteParser
getPosition
in interface ByteParser
public int peekByte()
ByteParser
ByteParser.getByteAsInt()
other
than for the fact that the position is not advanced.
peekByte
in interface ByteParser
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |