mayi-common/mayi-common-core/src/main/java/com/zf1976/mayi/common/core/util/ByteUtils.java
public static long fromLittleEndian(final InputStream in, final int length) throws IOException {
        // somewhat duplicates the ByteSupplier version in order to save the creation of a wrapper object
        checkReadLength(length);
        long l = 0;
        for (int i = 0; i < length; i++) {
            final long b = in.read();
            if (b == -1) {
                throw new IOException("Premature end of data");
            }
            l |= (b << (i * 8));
        }
        return l;
    }
/**
     * Reads the given number of bytes from the given stream as a little endian long.
     *
     * @param in     the stream to read from
     * @param length the number of bytes representing the value
     * @return the number read
     * @throws IllegalArgumentException if len is bigger than eight
     * @throws IOException              if reading fails or the stream doesn't
     *                                  contain the given number of bytes anymore
     */
Reads the given number of bytes from the given stream as a little endian long.
Reads the given number of bytes from the given stream as a little endian long .
public static long fromLittleEndian(final InputStream in, final int length) throws IOException {
        checkReadLength(length);
        long l = 0;
        for (int i = 0; i < length; i++) {
            final long b = in.read();
            if (b == -1) {
                throw new IOException("Premature end of data");
            }
            l |= (b << (i * 8));
        }
        return l;
    }
public static long fromLittleEndian ( final InputStream in , final int length ) throws IOException { checkReadLength ( length ) ; long l = 0 ; for ( int i = 0 ; i < length ; i ++ ) { final long b = in . read ( ) ; if ( b == - 1 ) { throw new IOException ( "Premature end of data" ) ; } l |= ( b << ( i * 8 ) ) ; } return l ; }
Reads the given number of bytes from the given stream as a little endian long.
Reads the given number of bytes from the given stream as a little endian long .
// somewhat duplicates the ByteSupplier version in order to save the creation of a wrapper object