UnMarshaller is the type of basic types unmarshallers. It should be used
by protocols.
bytesRead
public int bytesRead()
Returns the number of bytes read since the beginning.
- the number of bytes read since the beginning.
close
public void close()
Closes the target unmarshaller, releasing all underlying resources
(including a possible chunk provider).
getContext
public Context getContext()
Returns a Context
associated with this unmarshaller.
- a
Context
associated with this unmarshaller.
inputStream
public InputStream inputStream()
Returns an input stream to read data from the unmarshaller.
Closing the returned input stream has the same effect as closing the actual
unmarshaller.
- an input stream to read from the unmarshaller.
isLittleEndian
public boolean isLittleEndian()
Returns true if this unmarshaller is little-endian, false otherwise.
- true if this unmarshaller is little-endian, false otherwise.
readBoolean
public boolean readBoolean()
throws JonathanException
Reads a boolean.
- a boolean.
readByte
public byte readByte()
throws JonathanException
Reads a byte.
- a byte.
readByteArray
public void readByteArray(byte[] array,
int offset,
int len)
throws JonathanException
Reads an array of bytes.
array
- a byte array (of size >= offset + len)offset
- the position (in array) of the first byte to writelen
- the total number of bytes to read;
readChar16
public char readChar16()
throws JonathanException
Reads a 16 bits char.
- a char.
readChar8
public char readChar8()
throws JonathanException
Reads a 8 bits char.
- a char.
readDouble
public double readDouble()
throws JonathanException
Reads a double.
- a double.
readFloat
public float readFloat()
throws JonathanException
Reads a float.
- a float.
readInt
public int readInt()
throws JonathanException
Reads an int.
- an int.
readLong
public long readLong()
throws JonathanException
Reads a long.
- a long.
readReference
public Object readReference()
throws JonathanException
Reads a reference to an object.
- a reference to an object.
readShort
public short readShort()
throws JonathanException
Reads a short.
- a short.
readString16
public String readString16()
throws JonathanException
Reads a string composed of 16 bits chars.
- a string.
readString8
public String readString8()
throws JonathanException
Reads a string composed of 8 bits chars.
- a string.
readValue
public Object readValue()
throws JonathanException
Reads a value
- an object representing the read value
setByteOrder
public void setByteOrder(boolean little_endian)
Sets the byte order (returned by
isLittleEndian
) of
the target unmarshaller
little_endian
- the new byte order.
setSize
public void setSize(int size)
throws JonathanException
Sets the number of bytes readable from the unmarshaller.
Once this method has been called, it won't be possible to read more than the
size
specified bytes from this unmarshaller. Knowing the exact
number of readable bytes lets the unmarshaller free the resources (such as
a chunk provider) that won't be used. This method may block until the
expected number of bytes is readable.
size
- the expected number of readable bytes.