Class BitReader

java.lang.Object
org.javagi.base.ProxyInstance
org.freedesktop.gstreamer.base.BitReader
All Implemented Interfaces:
Proxy

@Generated("org.javagi.JavaGI") public class BitReader extends ProxyInstance
GstBitReader provides a bit reader that can read any number of bits from a memory buffer. It provides functions for reading any number of bits into 8, 16, 32 and 64 bit variables.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Allocate a new BitReader.
    BitReader(byte[] data, int size, int byte_, int bit)
    Allocate a new BitReader with the fields set to the provided values.
    BitReader(byte[] data, int size, int byte_, int bit, Arena arena)
    Allocate a new BitReader with the fields set to the provided values.
    Allocate a new BitReader.
    Create a BitReader proxy instance for the provided memory address.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Frees a GstBitReader instance, which was previously allocated by gst_bit_reader_new().
    boolean
    getBitsUint16(Out<Short> val, int nbits)
    Read nbits bits into val and update the current position.
    boolean
    getBitsUint32(Out<Integer> val, int nbits)
    Read nbits bits into val and update the current position.
    boolean
    getBitsUint64(Out<Long> val, int nbits)
    Read nbits bits into val and update the current position.
    boolean
    getBitsUint8(Out<Byte> val, int nbits)
    Read nbits bits into val and update the current position.
    The memory layout of the native struct.
    int
    Returns the current position of a GstBitReader instance in bits.
    int
    Returns the remaining number of bits of a GstBitReader instance.
    int
    Returns the total number of bits of a GstBitReader instance.
    void
    init(@Nullable byte @Nullable [] data)
    Initializes a GstBitReader instance to read from data. This function can be called on already initialized instances.
    static BitReader
    new_(@Nullable byte @Nullable [] data)
    Create a new GstBitReader instance, which will read from data.
    boolean
    peekBitsUint16(Out<Short> val, int nbits)
    Read nbits bits into val but keep the current position.
    boolean
    peekBitsUint32(Out<Integer> val, int nbits)
    Read nbits bits into val but keep the current position.
    boolean
    peekBitsUint64(Out<Long> val, int nbits)
    Read nbits bits into val but keep the current position.
    boolean
    peekBitsUint8(Out<Byte> val, int nbits)
    Read nbits bits into val but keep the current position.
    int
    Read the value of the field bit.
    int
    Read the value of the field byte.
    @Nullable byte @Nullable []
    Read the value of the field data.
    int
    Read the value of the field size.
    boolean
    setPos(int pos)
    Sets the new position of a GstBitReader instance to pos in bits.
    boolean
    skip(int nbits)
    Skips nbits bits of the GstBitReader instance.
    boolean
    Skips until the next byte.
    void
    writeBit(int bit)
    Write a value in the field bit.
    void
    writeByte(int byte_)
    Write a value in the field byte.
    void
    writeData(@Nullable byte @Nullable [] data, Arena _arena)
    Write a value in the field data.
    void
    writeSize(int size)
    Write a value in the field size.

    Methods inherited from class ProxyInstance

    equals, handle, hashCode

    Methods inherited from class Object

    clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • BitReader

      public BitReader(MemorySegment address)
      Create a BitReader proxy instance for the provided memory address.
      Parameters:
      address - the memory address of the native object
    • BitReader

      public BitReader(Arena arena)
      Allocate a new BitReader.
      Parameters:
      arena - to control the memory allocation scope
    • BitReader

      public BitReader()
      Allocate a new BitReader. The memory is allocated with Arena.ofAuto().
    • BitReader

      public BitReader(byte[] data, int size, int byte_, int bit, Arena arena)
      Allocate a new BitReader with the fields set to the provided values.
      Parameters:
      data - value for the field data
      size - value for the field size
      byte_ - value for the field byte_
      bit - value for the field bit
      arena - to control the memory allocation scope
    • BitReader

      public BitReader(byte[] data, int size, int byte_, int bit)
      Allocate a new BitReader with the fields set to the provided values. The memory is allocated with Arena.ofAuto().
      Parameters:
      data - value for the field data
      size - value for the field size
      byte_ - value for the field byte_
      bit - value for the field bit
  • Method Details

    • getMemoryLayout

      public static MemoryLayout getMemoryLayout()
      The memory layout of the native struct.
      Returns:
      the memory layout
    • readData

      public @Nullable byte @Nullable [] readData()
      Read the value of the field data.
      Returns:
      The value of the field data
    • writeData

      public void writeData(@Nullable byte @Nullable [] data, Arena _arena)
      Write a value in the field data.
      Parameters:
      data - The new value for the field data
      _arena - to control the memory allocation scope
    • readSize

      public int readSize()
      Read the value of the field size.
      Returns:
      The value of the field size
    • writeSize

      public void writeSize(int size)
      Write a value in the field size.
      Parameters:
      size - The new value for the field size
    • readByte

      public int readByte()
      Read the value of the field byte.
      Returns:
      The value of the field byte
    • writeByte

      public void writeByte(int byte_)
      Write a value in the field byte.
      Parameters:
      byte_ - The new value for the field byte
    • readBit

      public int readBit()
      Read the value of the field bit.
      Returns:
      The value of the field bit
    • writeBit

      public void writeBit(int bit)
      Write a value in the field bit.
      Parameters:
      bit - The new value for the field bit
    • new_

      public static BitReader new_(@Nullable byte @Nullable [] data)

      Create a new GstBitReader instance, which will read from data.

      Free-function: gst_bit_reader_free

      Parameters:
      data - Data from which the GstBitReader should read
      Returns:
      a new GstBitReader instance
    • free

      public void free()
      Frees a GstBitReader instance, which was previously allocated by gst_bit_reader_new().
    • getBitsUint16

      public boolean getBitsUint16(Out<Short> val, int nbits)
      Read nbits bits into val and update the current position.
      Parameters:
      val - Pointer to a guint16 to store the result
      nbits - number of bits to read
      Returns:
      true if successful, false otherwise.
    • getBitsUint32

      public boolean getBitsUint32(Out<Integer> val, int nbits)
      Read nbits bits into val and update the current position.
      Parameters:
      val - Pointer to a guint32 to store the result
      nbits - number of bits to read
      Returns:
      true if successful, false otherwise.
    • getBitsUint64

      public boolean getBitsUint64(Out<Long> val, int nbits)
      Read nbits bits into val and update the current position.
      Parameters:
      val - Pointer to a guint64 to store the result
      nbits - number of bits to read
      Returns:
      true if successful, false otherwise.
    • getBitsUint8

      public boolean getBitsUint8(Out<Byte> val, int nbits)
      Read nbits bits into val and update the current position.
      Parameters:
      val - Pointer to a guint8 to store the result
      nbits - number of bits to read
      Returns:
      true if successful, false otherwise.
    • getPos

      public int getPos()
      Returns the current position of a GstBitReader instance in bits.
      Returns:
      The current position of this BitReader in bits.
    • getRemaining

      public int getRemaining()
      Returns the remaining number of bits of a GstBitReader instance.
      Returns:
      The remaining number of bits of this BitReader instance.
    • getSize

      public int getSize()
      Returns the total number of bits of a GstBitReader instance.
      Returns:
      The total number of bits of this BitReader instance.
    • init

      public void init(@Nullable byte @Nullable [] data)
      Initializes a GstBitReader instance to read from data. This function can be called on already initialized instances.
      Parameters:
      data - data from which the bit reader should read
    • peekBitsUint16

      public boolean peekBitsUint16(Out<Short> val, int nbits)
      Read nbits bits into val but keep the current position.
      Parameters:
      val - Pointer to a guint16 to store the result
      nbits - number of bits to read
      Returns:
      true if successful, false otherwise.
    • peekBitsUint32

      public boolean peekBitsUint32(Out<Integer> val, int nbits)
      Read nbits bits into val but keep the current position.
      Parameters:
      val - Pointer to a guint32 to store the result
      nbits - number of bits to read
      Returns:
      true if successful, false otherwise.
    • peekBitsUint64

      public boolean peekBitsUint64(Out<Long> val, int nbits)
      Read nbits bits into val but keep the current position.
      Parameters:
      val - Pointer to a guint64 to store the result
      nbits - number of bits to read
      Returns:
      true if successful, false otherwise.
    • peekBitsUint8

      public boolean peekBitsUint8(Out<Byte> val, int nbits)
      Read nbits bits into val but keep the current position.
      Parameters:
      val - Pointer to a guint8 to store the result
      nbits - number of bits to read
      Returns:
      true if successful, false otherwise.
    • setPos

      public boolean setPos(int pos)
      Sets the new position of a GstBitReader instance to pos in bits.
      Parameters:
      pos - The new position in bits
      Returns:
      true if the position could be set successfully, false otherwise.
    • skip

      public boolean skip(int nbits)
      Skips nbits bits of the GstBitReader instance.
      Parameters:
      nbits - the number of bits to skip
      Returns:
      true if nbits bits could be skipped, false otherwise.
    • skipToByte

      public boolean skipToByte()
      Skips until the next byte.
      Returns:
      true if successful, false otherwise.