public interface ZigBeeDataInput
ZigBeeDataInput interface is designed for converting a series of
 bytes in Java data types. The purpose of this interface is the same as the
 DataInput interface available in the standard Java library, with the
 difference that in this interface, byte ordering is little endian, whereas in
 the DataInput interface is big endian.
 
 
 Each method provided by this interface read one or more bytes from the
 underlying stream, combine them, and return a Java data type. The pointer to
 the stream is then moved immediately after the last byte read. If this
 pointer past the available buffer bounds, a subsequent call to one of these
 methods will throw a EOFException.
| Modifier and Type | Method and Description | 
|---|---|
byte | 
readByte()
Reads a byte from the DataInput Stream. 
 | 
byte[] | 
readBytes(int len)
Reads the specified amount of bytes from the underlying stream and return
 a copy of them. 
 | 
double | 
readDouble()
Reads a number of type Double. 
 | 
float | 
readFloat(int size)
Reads a number of type Float. 
 | 
int | 
readInt(int size)
Reads an integer of the specified  
size. | 
long | 
readLong(int size)
Reads a certain amount of bytes and returns a long. 
 | 
byte readByte()
       throws IOException
EOFException - When the end of the input has been reached and there
         are no more data to read.IOException - If an I/O error occurs.int readInt(int size)
     throws IOException
size. The sign bit of the
 size-bytes integer is left-extended. In other words if a
 readInt(2) is issued and the byte read are 0x01, 0x02 and 0xf0,
 the method returns 0xfff00201. For this reason if the 4 bytes read from
 the stream represent an unsigned value, to get the expected value the and
 bitwise operator must be used:
 
 
 int u = readInt(3) & 0xffffff;
size - the number of bytes that have to be read. Allowed values for
        this parameter are in the range [1, 4].EOFException - When the end of the input has been reached and there
         are no more data to read.IOException - If an I/O error occurs.IllegalArgumentException - If the passed size is not in the
         allowed range.long readLong(int size)
       throws IOException
size-bytes long is left-extended. In other words if a
 readLong(2) is issued and the byte read are 0x01 and 0xf0, the method
 returns 0xfffffffffffff001L. For this reason if the 2 bytes read from the
 stream represent an unsigned value, to get the expected value the and
 bitwise operator must be used:
 
 
 long u = readLong(2) & 0xffff;
size - the number of bytes that have to be read. Allowed values for
        this parameter are in the range [1, 8].long value read from the data input.EOFException - if there are not at least size bytes left on
         the data input.IOException - If an I/O error occurs.IllegalArgumentException - If the passed size is not in the
         allowed range.float readFloat(int size)
         throws IOException
size - expected value for this parameter are 2 or 4 depending if
        reading ZigBeeDataTypes.FLOATING_SEMI or
        ZigBeeDataTypes.FLOATING_SINGLE.float number read from the data input.EOFException - if there are not at least size bytes left on
         the data input.IOException - If an I/O error occurs.IllegalArgumentException - If the passed size is not in the
         allowed range.double readDouble()
           throws IOException
EOFException - if there are not at least size 8 bytes left
         on the data input.IOException - If an I/O error occurs.byte[] readBytes(int len)
          throws IOException
len - the number of bytes to read.EOFException - if there are not at least len bytes left on
         the data input.IOException - If an I/O error occurs.Copyright © Contributors to the Eclipse Foundation Licensed under the Eclipse Foundation Specification License – v1.0