Java InputStream Read Long readLong(InputStream is)

Here you can find the source of readLong(InputStream is)

Description

read Long

License

Apache License

Declaration

public static long readLong(InputStream is) throws IOException 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.io.IOException;
import java.io.InputStream;

public class Main {
    public static long readLong(InputStream is) throws IOException {
        byte[] bytes = new byte[8];
        is.read(bytes);/*from ww w . ja v a 2  s.c o m*/
        return getLong(bytes);
    }

    public static long getLong(byte[] b) {
        return (b[0] & 0xFFL) << 0 | (b[1] & 0xFFL) << 8 | (b[2] & 0xFFL) << 16 | (b[3] & 0xFFL) << 24
                | (b[4] & 0xFFL) << 32 | (b[5] & 0xFFL) << 40 | (b[6] & 0xFFL) << 48 | (b[7] & 0xFFL) << 56;
    }
}

Related

  1. readLong(InputStream in)
  2. readLong(InputStream in)
  3. readLong(InputStream input)
  4. readLong(InputStream inputStream)
  5. readLong(InputStream inputStream)
  6. readLong(InputStream is)
  7. readLong(InputStream is)
  8. readLong(InputStream is)
  9. readLong(InputStream is)