public class ByteReader extends Object
Basically wraps a ByteBuffer
and keeps track of the current offset. All requests on
this ByteReader
will be delegated to wrappedByteBuffer
.
ByteBuffer
Constructor and Description |
---|
ByteReader(byte[] _bytes)
Construct form an array of bytes.
|
ByteReader(ByteBuffer _byteBuffer)
Construct form a given ByteBuffer.
|
ByteReader(InputStream _inputStream)
Construct form an input stream (say a ClassFile).
|
Modifier and Type | Method and Description |
---|---|
byte[] |
bytes(int _length) |
double |
d8() |
float |
f4() |
int |
getOffset() |
boolean |
hasMore() |
int |
peekU2() |
int |
s2() |
int |
s4() |
void |
setOffset(int _offset) |
void |
skip(int _length) |
int |
u1() |
int |
u2() |
int |
u4() |
long |
u8() |
String |
utf8() |
public ByteReader(ByteBuffer _byteBuffer)
_byteBuffer
- an existing ByteBuffer
public ByteReader(byte[] _bytes)
_bytes
- an existing byte arraypublic ByteReader(InputStream _inputStream)
_inputStream
- a stream of bytespublic int u1()
public int u2()
public int s2()
public int peekU2()
public int u4()
public int s4()
public long u8()
public float f4()
public double d8()
public String utf8()
public byte[] bytes(int _length)
public void skip(int _length)
public int getOffset()
public void setOffset(int _offset)
public boolean hasMore()
Copyright © 2016 Syncleus. All rights reserved.