List of utility methods to do DataInputStream Read
int | uint16FromStream(DataInputStream stream) uint From Stream return (int) (((stream.read() & 0xFFL) << 0) | ((stream.read() & 0xFFL) << 8)); |
int | uint16FromStreamBE(DataInputStream stream) uint From Stream BE return (int) (((stream.read() & 0xFFL) << 8) | ((stream.read() & 0xFFL) << 0)); |
int | uint32FromStream(DataInputStream stream) uint From Stream return (int) (((stream.read() & 0xFFL) << 0) | ((stream.read() & 0xFFL) << 8) | ((stream.read() & 0xFFL) << 16) | ((stream.read() & 0xFFL) << 24)); |
long | uint64FromStream(DataInputStream stream) uint From Stream return ((stream.read() & 0xFFL) << 0)
| ((stream.read() & 0xFFL) << 8)
| ((stream.read() & 0xFFL) << 16)
| ((stream.read() & 0xFFL) << 24)
| ((stream.read() & 0xFFL) << 32)
| ((stream.read() & 0xFFL) << 40)
| ((stream.read() & 0xFFL) << 48)
| ((stream.read() & 0xFFL) << 56);
...
|
byte[] | readBytes(DataInputStream stream, int size) Read a number of bytes or throw. byte[] buf = new byte[size]; int toRead = size; int done = 0; while (toRead > 0) { int read = stream.read(buf, done, toRead); if (read == -1) { throw new IOException(); done += read; toRead -= read; return buf; |