Java DataInput Read Long readLong(DataInput dataInput)

Here you can find the source of readLong(DataInput dataInput)

Description

read Long

License

Apache License

Declaration

public static long readLong(DataInput dataInput) throws IOException 

Method Source Code


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

import java.io.DataInput;

import java.io.IOException;

public class Main {
    public static long readLong(DataInput dataInput) throws IOException {
        byte[] bytes = new byte[8];
        dataInput.readFully(bytes);//from w  ww.  ja v  a  2  s . co  m
        return (((long) bytes[7] << 56) + ((long) (bytes[6] & 255) << 48) + ((long) (bytes[5] & 255) << 40)
                + ((long) (bytes[4] & 255) << 32) + ((long) (bytes[3] & 255) << 24) + ((bytes[2] & 255) << 16)
                + ((bytes[1] & 255) << 8) + ((bytes[0] & 255) << 0));
    }
}

Related

  1. readLong(DataInput in)
  2. readLong(DataInput in)
  3. readLongSequence(DataInput in)
  4. readLongUTF8(DataInput in)