/** * Read one single unsigned short (2 bytes) value from the buffer. * @return the unsigned short value as int * @throws IOException if an error occurs during reading */ public int readUnsignedShort() throws IOException { int b1 = read(); int b2 = read(); if ((b1 | b2) < 0) { throw new EOFException(); } return b1 << 8 | b2; }
/** * Read one single int (4 bytes) from the buffer. * @return the int value * @throws IOException if an error occurs during reading */ public int readInt() throws IOException { int b1 = read(); int b2 = read(); int b3 = read(); int b4 = read(); if ((b1 | b2 | b3 | b4) < 0) { throw new EOFException(); } return b1 << 24 | b2 << 16 | b3 << 8 | b4; }
/** * Read one single unsigned byte from the buffer. * @return the unsigned byte as int * @throws IOException if an error occurs during reading */ public int readUnsignedByte() throws IOException { int b = read(); if (b < 0) { throw new EOFException(); } return b; }
/** * Read one single int (4 bytes) from the buffer. * @return the int value * @throws IOException if an error occurs during reading */ public int readInt() throws IOException { int b1 = read(); int b2 = read(); int b3 = read(); int b4 = read(); if ((b1 | b2 | b3 | b4) < 0) { throw new EOFException(); } return b1 << 24 | b2 << 16 | b3 << 8 | b4; }
/** * Read one single unsigned short (2 bytes) value from the buffer. * @return the unsigned short value as int * @throws IOException if an error occurs during reading */ public int readUnsignedShort() throws IOException { int b1 = read(); int b2 = read(); if ((b1 | b2) < 0) { throw new EOFException(); } return b1 << 8 | b2; }
/** * Read one single unsigned short (2 bytes) value from the buffer. * @return the unsigned short value as int * @throws IOException if an error occurs during reading */ public int readUnsignedShort() throws IOException { int b1 = read(); int b2 = read(); if ((b1 | b2) < 0) { throw new EOFException(); } return b1 << 8 | b2; }
/** * Read one single int (4 bytes) from the buffer. * @return the int value * @throws IOException if an error occurs during reading */ public int readInt() throws IOException { int b1 = read(); int b2 = read(); int b3 = read(); int b4 = read(); if ((b1 | b2 | b3 | b4) < 0) { throw new EOFException(); } return b1 << 24 | b2 << 16 | b3 << 8 | b4; }
/** * Read one single unsigned byte from the buffer. * @return the unsigned byte as int * @throws IOException if an error occurs during reading */ public int readUnsignedByte() throws IOException { int b = read(); if (b < 0) { throw new EOFException(); } return b; }
/** * Read one single unsigned byte from the buffer. * @return the unsigned byte as int * @throws IOException if an error occurs during reading */ public int readUnsignedByte() throws IOException { int b = read(); if (b < 0) { throw new EOFException(); } return b; }