Android Utililty Methods DataInputStream Read

List of utility methods to do DataInputStream Read

Description

The list of methods to do DataInputStream Read are organized into topic(s).

Method

intuint16FromStream(DataInputStream stream)
uint From Stream
return (int) (((stream.read() & 0xFFL) << 0) | ((stream.read() & 0xFFL) << 8));
intuint16FromStreamBE(DataInputStream stream)
uint From Stream BE
return (int) (((stream.read() & 0xFFL) << 8) | ((stream.read() & 0xFFL) << 0));
intuint32FromStream(DataInputStream stream)
uint From Stream
return (int) (((stream.read() & 0xFFL) << 0)
        | ((stream.read() & 0xFFL) << 8)
        | ((stream.read() & 0xFFL) << 16) | ((stream.read() & 0xFFL) << 24));
longuint64FromStream(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;