Esempio n. 1
0
 // 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));
 }
Esempio n. 2
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);
        }
Esempio n. 3
0
 // 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);
 }
Esempio n. 4
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;
        }