Class ByteReader

java.lang.Object
com.aparapi.internal.reader.ByteReader

public class ByteReader
extends Object
Primarily used to parse various ClassFile structures. This class provides low level access to sequential bytes in a stream given stream.

Basically wraps a ByteBuffer and keeps track of the current offset. All requests on this ByteReader will be delegated to wrappedByteBuffer.

Author:
gfrost
See Also:
ByteBuffer
  • Constructor Details

    • ByteReader

      public ByteReader​(ByteBuffer _byteBuffer)
      Construct form a given ByteBuffer.
      Parameters:
      _byteBuffer - an existing ByteBuffer
    • ByteReader

      public ByteReader​(byte[] _bytes)
      Construct form an array of bytes.
      Parameters:
      _bytes - an existing byte array
    • ByteReader

      public ByteReader​(InputStream _inputStream)
      Construct form an input stream (say a ClassFile).
      Parameters:
      _inputStream - a stream of bytes
  • Method Details

    • u1

      public int u1()
    • u2

      public int u2()
    • s2

      public int s2()
    • peekU2

      public int peekU2()
    • u4

      public int u4()
    • s4

      public int s4()
    • u8

      public long u8()
    • f4

      public float f4()
    • d8

      public double d8()
    • utf8

      public String utf8()
    • bytes

      public byte[] bytes​(int _length)
    • skip

      public void skip​(int _length)
    • getOffset

      public int getOffset()
    • setOffset

      public void setOffset​(int _offset)
    • hasMore

      public boolean hasMore()