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 i)
read Long
return ((long) (readInt(i)) << 32) + (readInt(i) & 0xFFFFFFFFL);
longreadLong(InputStream in)
read Long
long result = 0;
for (int shift = 56; shift >= 0; shift -= 8) {
    long x = in.read();
    if (x < 0)
        throw new IOException("EOF");
    result |= (x << shift);
return result;
...
longreadLong(InputStream in)
read Long
long ch8 = in.read();
long ch7 = in.read();
long ch6 = in.read();
long ch5 = in.read();
long ch4 = in.read();
long ch3 = in.read();
long ch2 = in.read();
long ch1 = in.read();
...
longreadLong(InputStream in)
read Long
byte[] b = new byte[8];
read(in, b, 0, b.length);
long l = b[0] & 0xff;
l |= (long) (b[1] & 0xff) << 8;
l |= (long) (b[2] & 0xff) << 16;
l |= (long) (b[3] & 0xff) << 24;
l |= (long) (b[4] & 0xff) << 32;
l |= (long) (b[5] & 0xff) << 40;
...
longreadLong(InputStream in)
read Long
long b0 = safeRead(in);
long b1 = safeRead(in);
long b2 = safeRead(in);
long b3 = safeRead(in);
long b4 = safeRead(in);
long b5 = safeRead(in);
long b6 = safeRead(in);
long b7 = safeRead(in);
...
longreadLong(InputStream in)
Read a long (8 bytes).
return ((long) (readInt(in)) << 32) + (readInt(in) & 0xffffffffL);
longreadLong(InputStream in)
Reads a long from in.
byte b[] = new byte[8];
int cnt = read(in, b);
if (cnt < 8) {
    if (cnt <= 0) {
        throw new IOException("readLong: the imput stream is empty.");
    } else {
        throw new IOException("readLong: not enought bytes.");
return byteArrayToLong(b);
longreadLong(InputStream in)
Read an long.
return ((long) in.read() << 56) | ((long) in.read() << 48) | ((long) in.read() << 40)
        | ((long) in.read() << 32) | ((long) in.read() << 24) | ((long) in.read() << 16)
        | ((long) in.read() << 8) | (long) in.read();
longreadLong(InputStream in)
read Long
byte[] b = new byte[8];
read(in, b, 0, b.length);
long l = (long) (b[0] & 0xff);
l |= (long) (b[1] & 0xff) << 8;
l |= (long) (b[2] & 0xff) << 16;
l |= (long) (b[3] & 0xff) << 24;
l |= (long) (b[4] & 0xff) << 32;
l |= (long) (b[5] & 0xff) << 40;
...
longreadLong(InputStream in)
read Long
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();
long b8 = in.read();
...