public class ConfInputStream extends ByteArrayInputStream
Note that this class is not synchronized, if you need synchronization you must provide it yourself.
Constructor and Description |
---|
ConfInputStream(byte[] buf)
Create a stream from a buffer containing encoded E terms.
|
ConfInputStream(byte[] buf,
int offset,
int length)
Create a stream from a buffer containing encoded E terms at the given
offset and length.
|
Modifier and Type | Method and Description |
---|---|
int |
getPos()
Get the current position in the stream.
|
int |
peek()
Look ahead one position in the stream without consuming the byte found
there.
|
ConfEObject |
read_any()
Read an arbitrary E term from the stream.
|
String |
read_atom()
Read an E atom from the stream.
|
BigInteger |
read_big() |
byte[] |
read_binary()
Read an E binary from the stream.
|
boolean |
read_boolean()
Read an E atom from the stream and interpret the value as a boolean.
|
byte |
read_byte()
Read one byte from the stream.
|
char |
read_char()
Read a character from the stream.
|
double |
read_double()
Read an E float from the stream.
|
float |
read_float()
Read an E float from the stream.
|
int |
read_int()
Read an integer from the stream.
|
int |
read_list_head()
Read a list header from the stream.
|
ConfEObject |
read_long_big() |
long |
read_long()
Read a long from the stream.
|
long |
read_long(boolean unsigned) |
int |
read_nil()
Read an empty list from the stream.
|
ConfEPid |
read_pid()
Read an E pid from the stream.
|
ConfERef |
read_ref()
Read an E reference from the stream.
|
short |
read_short()
Read a short from the stream.
|
String |
read_string()
Read a string from the stream.
|
int |
read_tuple_head()
Read a tuple header from the stream.
|
int |
read_uint()
Read an unsigned integer from the stream.
|
long |
read_ulong()
Read an unsigned long from the stream.
|
short |
read_ushort()
Read an unsigned short from the stream.
|
int |
read1()
Read a one byte integer from the stream.
|
int |
read2BE()
Read a two byte big endian integer from the stream.
|
int |
read2LE()
Read a two byte little endian integer from the stream.
|
int |
read4BE()
Read a four byte big endian integer from the stream.
|
int |
read4LE()
Read a four byte little endian integer from the stream.
|
long |
readBE(int n)
Read a big endian integer from the stream.
|
long |
readLE(int n)
Read a little endian integer from the stream.
|
int |
readN(byte[] buf)
Read an array of bytes from the stream.
|
int |
setPos(int pos)
Set the current position in the stream.
|
available, close, mark, markSupported, read, read, reset, skip
read
public ConfInputStream(byte[] buf)
public ConfInputStream(byte[] buf, int offset, int length)
public int getPos()
public int setPos(int pos)
pos
- the position to move to in the stream. If pos indicates a
position beyond the end of the stream, the position is move to
the end of the stream instead. If pos is negative, the
position is moved to the beginning of the stream instead.public int readN(byte[] buf) throws ConfEDecodeException
ConfEDecodeException
- if the next byte cannot be read.public int peek() throws ConfEDecodeException
ConfEDecodeException
- if the next byte cannot be read.public int read1() throws ConfEDecodeException
ConfEDecodeException
- if the next byte cannot be read.public int read2BE() throws ConfEDecodeException
ConfEDecodeException
- if the next byte cannot be read.public int read4BE() throws ConfEDecodeException
ConfEDecodeException
- if the next byte cannot be read.public int read2LE() throws ConfEDecodeException
ConfEDecodeException
- if the next byte cannot be read.public int read4LE() throws ConfEDecodeException
ConfEDecodeException
- if the next byte cannot be read.public long readLE(int n) throws ConfEDecodeException
n
- the number of bytes to readConfEDecodeException
- if the next byte cannot be read.public long readBE(int n) throws ConfEDecodeException
n
- the number of bytes to readConfEDecodeException
- if the next byte cannot be read.public boolean read_boolean() throws ConfEDecodeException
ConfEDecodeException
- if the next term in the stream is not an atom.public String read_atom() throws ConfEDecodeException
ConfEDecodeException
- if the next term in the stream is not an atom.public byte[] read_binary() throws ConfEDecodeException
ConfEDecodeException
- if the next term in the stream is not a binary.public float read_float() throws ConfEDecodeException
ConfEDecodeException
- if the next term in the stream is not a float.public double read_double() throws ConfEDecodeException
ConfEDecodeException
- if the next term in the stream is not a float.public byte read_byte() throws ConfEDecodeException
ConfEDecodeException
- if the next byte cannot be read.public char read_char() throws ConfEDecodeException
ConfEDecodeException
- if the next term in the stream is not an integer that can
be represented as a char.public int read_uint() throws ConfEDecodeException
ConfEDecodeException
- if the next term in the stream can not be represented
as a positive integer.public int read_int() throws ConfEDecodeException
ConfEDecodeException
- if the next term in the stream can not be represented as
an integer.public short read_ushort() throws ConfEDecodeException
ConfEDecodeException
- if the next term in the stream can not be represented as a
positive short.public short read_short() throws ConfEDecodeException
ConfEDecodeException
- if the next term in the stream can not be represented as a
short.public long read_ulong() throws ConfEDecodeException
ConfEDecodeException
- if the next term in the stream can not be represented as a
positive long.public long read_long() throws ConfEDecodeException
ConfEDecodeException
- if the next term in the stream can not be
represented as a long.public long read_long(boolean unsigned) throws ConfEDecodeException
ConfEDecodeException
public ConfEObject read_long_big() throws ConfEDecodeException
ConfEDecodeException
public BigInteger read_big() throws ConfEDecodeException
ConfEDecodeException
public int read_list_head() throws ConfEDecodeException
ConfEDecodeException
- if the next term in the stream is not a list.public int read_tuple_head() throws ConfEDecodeException
ConfEDecodeException
- if the next term in the stream is not a tuple.public int read_nil() throws ConfEDecodeException
ConfEDecodeException
- if the next term in the stream is not an empty list.public ConfERef read_ref() throws ConfEDecodeException
ConfEDecodeException
- if the next term in the stream is not an E reference.public ConfEPid read_pid() throws ConfEDecodeException
ConfEDecodeException
- if the next term in the stream is not an E pid.public String read_string() throws ConfEDecodeException
ConfEDecodeException
- if the next term in the stream is not a string.public ConfEObject read_any() throws ConfEDecodeException
ConfEDecodeException
- if the stream does not contain a known E type at the next
position.