Beispiel #1
0
 /**
  * Read a four byte little endian integer from the stream.
  *
  * @return the bytes read, converted from little endian to an integer.
  * @exception IOException if the next byte cannot be read.
  */
 public int read4LE() throws IOException {
   final byte[] b = new byte[4];
   readFully(b);
   return (b[3] << 24 & 0xff000000)
       + (b[2] << 16 & 0xff0000)
       + (b[1] << 8 & 0xff00)
       + (b[0] & 0xff);
 }
Beispiel #2
0
 /**
  * Read a two byte little endian integer from the stream.
  *
  * @return the bytes read, converted from little endian to an integer.
  * @exception IOException if the next byte cannot be read.
  */
 public int read2LE() throws IOException {
   final byte[] b = new byte[2];
   readFully(b);
   return (b[1] << 8 & 0xff00) + (b[0] & 0xff);
 }