public static long read8Bytes(final String name, final InputStream in, final String exception, final ByteOrder byteOrder) throws IOException {
        final long byte0 = in.read();
        final long byte1 = in.read();
        final long byte2 = in.read();
        final long byte3 = in.read();
        final long byte4 = in.read();
        final long byte5 = in.read();
        final long byte6 = in.read();
        final long byte7 = in.read();
        if ((byte0 | byte1 | byte2 | byte3 | byte4 | byte5 | byte6 | byte7) < 0) {
            throw new IOException(exception);
        }
        final long result;
        if (byteOrder == ByteOrder.BIG_ENDIAN) {
            result = byte0 << 56 | byte1 << 48 | byte2 << 40 | byte3 << 32 | byte4 << 24 | byte5 << 16 | byte6 << 8 | byte7 << 0;
        } else {
            result = byte7 << 56 | byte6 << 48 | byte5 << 40 | byte4 << 32 | byte3 << 24 | byte2 << 16 | byte1 << 8 | byte0 << 0;
        }
        return result;
    }
Reads eight bytes from the specified input stream, adjust for byte order, and return a long integer.

@param name      a descriptive identifier used for diagnostic purposes
@param in        a valid input stream
@param exception application-defined message to be used for constructing an exception if an error condition is triggered.
@param byteOrder the order in which the InputStream marshals data
@return a long integer interpreted from next 8 bytes in the InputStream
@throws IOException in the event of a non-recoverable error, such as an attempt to read past the end of file.
src/main/java/org/apache/commons/imaging/common/BinaryFunctions.java