Package com.google.android.exoplayer2.extractor

## Class VorbisBitArray

- java.lang.Object
- - com.google.android.exoplayer2.extractor.VorbisBitArray

-     public final class VorbisBitArray
      extends Object

  Wraps a byte array, providing methods that allow it to be read as a Vorbis bitstream.
  See Also:
    Vorbis bitpacking specification

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `VorbisBitArray​(byte[] data)` | Creates a new instance that wraps an existing array.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `int` | `bitsLeft()` | Returns the number of remaining bits.
    `int` | `getPosition()` | Returns the reading position in bits.
    `boolean` | `readBit()` | Reads a single bit.
    `int` | `readBits​(int numBits)` | Reads up to 32 bits.
    `void` | `reset()` | Resets the reading position to zero.
    `void` | `setPosition​(int position)` | Sets the reading position in bits.
    `void` | `skipBits​(int numBits)` | Skips `numberOfBits` bits.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### VorbisBitArray

          public VorbisBitArray​(byte[] data)

      Creates a new instance that wraps an existing array.
      Parameters:
        `data` - the array to wrap.

  - ### Method Detail

    - #### reset

          public void reset()

      Resets the reading position to zero.

    - #### readBit

          public boolean readBit()

      Reads a single bit.
      Returns:
        `true` if the bit is set, `false` otherwise.

    - #### readBits

          public int readBits​(int numBits)

      Reads up to 32 bits.
      Parameters:
        `numBits` - The number of bits to read.
      Returns:
        An integer whose bottom `numBits` bits hold the read data.

    - #### skipBits

          public void skipBits​(int numBits)

      Skips `numberOfBits` bits.
      Parameters:
        `numBits` - The number of bits to skip.

    - #### getPosition

          public int getPosition()

      Returns the reading position in bits.

    - #### setPosition

          public void setPosition​(int position)

      Sets the reading position in bits.
      Parameters:
        `position` - The new reading position in bits.

    - #### bitsLeft

          public int bitsLeft()

      Returns the number of remaining bits.