// comsumes integer value from buffers private static int consumeInt(ByteIterator bytes) { byte[] buf = { bytes.next(), bytes.next(), bytes.next(), bytes.next() }; return(readInt(buf, 0)); }
// reads a byte array of given length private static byte[] consumeBytes(ByteIterator bytes, int length) { int paddedLength = roundTo4(length); byte[] buf = new byte[length]; for (int i = 0; i != length; ++i) { buf[i] = bytes.next(); } // consume the remaining padding bytes (if any) for (int i = length; i != paddedLength; ++i) { bytes.next(); } return(buf); }
// comsumes integer value from buffers private static int consumeInt(ByteIterator bytes) { byte[] buf = { bytes.next(), bytes.next(), bytes.next(), bytes.next() }; return readInt(buf, 0); }
// reads a byte array of given length private static byte[] consumeBytes(ByteIterator bytes, int length) { int paddedLength = roundTo4(length); byte[] buf = new byte[length]; for(int i = 0; i != length; ++i) { buf[i] = bytes.next(); } // consume the remaining padding bytes (if any) for(int i = length; i != paddedLength; ++i) { bytes.next(); } return buf; }