|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.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 ByteParserpublic byte[] getBytes(int count)
ByteParsercount bytes.
getBytes in interface ByteParsercount - the number of bytes to read.
public int getByteAsInt()
ByteParserint.
getByteAsInt in interface ByteParserpublic int getShortAsInt()
ByteParserint.
getShortAsInt in interface ByteParserpublic long getInt()
ByteParserlong.
getInt in interface ByteParser@Deprecated public ByteParser getNewParser()
ByteParser
getNewParser in interface ByteParserpublic void setBigEndian(boolean bigEndian)
ByteParser
setBigEndian in interface ByteParserbigEndian - a boolean value true for big-endian mode, false
for non-big-endian mode.public boolean hasMore()
ByteParser
hasMore in interface ByteParserpublic int getPosition()
ByteParser
getPosition in interface ByteParserpublic int peekByte()
ByteParserByteParser.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 | |||||||||