mayi-common/mayi-common-core/src/main/java/com/zf1976/mayi/common/core/util/ByteUtils.java
public static long fromLittleEndian(final ByteSupplier supplier, final int length) throws IOException {
        checkReadLength(length);
        long l = 0;
        for (int i = 0; i < length; i++) {
            final long b = supplier.getAsByte();
            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 supplier as a little endian long.
     *
     * <p>Typically used by our InputStreams that need to count the
     * bytes read as well.</p>
     *
     * @param supplier the supplier for bytes
     * @param length   the number of bytes representing the value
     * @return the number read
     * @throws IllegalArgumentException if len is bigger than eight
     * @throws IOException              if the supplier fails or doesn't supply the
     *                                  given number of bytes anymore
     */
Reads the given number of bytes from the given supplier as a little endian long.
Typically used by our InputStreams that need to count the
bytes read as well.


Reads the given number of bytes from the given supplier as a little endian long . Typically used by our InputStreams that need to count the bytes read as well .
public static long fromLittleEndian(final ByteSupplier supplier, final int length) throws IOException {
        checkReadLength(length);
        long l = 0;
        for (int i = 0; i < length; i++) {
            final long b = supplier.getAsByte();
            if (b == -1) {
                throw new IOException("Premature end of data");
            }
            l |= (b << (i * 8));
        }
        return l;
    }
public static long fromLittleEndian ( final ByteSupplier supplier , final int length ) throws IOException { checkReadLength ( length ) ; long l = 0 ; for ( int i = 0 ; i < length ; i ++ ) { final long b = supplier . getAsByte ( ) ; 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 supplier as a little endian long.
Reads the given number of bytes from the given supplier as a little endian long .