Java Utililty Methods InputStream Read Long

List of utility methods to do InputStream Read Long

Description

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

Method

longreadLong(InputStream is)
read Long
long n = 0;
n |= ((read(is) & 0xFFL) << 0);
n |= ((read(is) & 0xFFL) << 8);
n |= ((read(is) & 0xFFL) << 16);
n |= ((read(is) & 0xFFL) << 24);
n |= ((read(is) & 0xFFL) << 32);
n |= ((read(is) & 0xFFL) << 40);
n |= ((read(is) & 0xFFL) << 48);
...
longreadLong(InputStream stream)
read Long
long result = 0;
for (int i = 0; i < BITS_IN_LONG; i += BITS_IN_BYTE)
    result |= ((long) readByte(stream)) << i;
return result;
longreadLong(InputStream stream)
read Long
long a = readUInt(stream);
long b = readUInt(stream);
return a + (b << 32);
longreadLong(InputStream stream)
Reading long from stream
long a = readUInt(stream);
long b = readUInt(stream);
return a + (b << 32);
intreadLong(InputStream stream)
read Long
return readInt(stream);
longreadLongFrom(InputStream is)
This method allows to restore a long from the input stream.
byte[] buf = readFully(8, is);
return ((buf[0] & 0xFFL) << 56) | ((buf[1] & 0xFFL) << 48) | ((buf[2] & 0xFFL) << 40)
        | ((buf[3] & 0xFFL) << 32) | ((buf[4] & 0xFFL) << 24) | ((buf[5] & 0xFFL) << 16)
        | ((buf[6] & 0xFFL) << 8) | (buf[7] & 0xFFL);
longreadLongLE(InputStream in)
read Long LE
long ret = -1;
if (in != null) {
    ret = 0;
    for (int i = 0; i < 8; i++) {
        long i1 = in.read() & 0x0ff;
        ret += (i1 << (i * 8));
return ret;
longreadLongLE(InputStream in)
read little-endian long
long b0 = in.read();
long b1 = in.read();
long b2 = in.read();
long b3 = in.read();
long b4 = in.read();
long b5 = in.read();
long b6 = in.read();
long b7 = in.read();
...