Package com.google.android.exoplayer2.decoder

## Class Buffer

- java.lang.Object
- - com.google.android.exoplayer2.decoder.Buffer

- Direct Known Subclasses:
    `DecoderInputBuffer`, `OutputBuffer`

      public abstract class Buffer
      extends Object

  Base class for buffers with flags.

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `Buffer()` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `addFlag​(int flag)` | Adds the `flag` to this buffer's flags.
    `void` | `clear()` | Clears the buffer.
    `void` | `clearFlag​(int flag)` | Removes the `flag` from this buffer's flags, if it is set.
    `protected boolean` | `getFlag​(int flag)` | Returns whether the specified flag has been set on this buffer.
    `boolean` | `hasSupplementalData()` | Returns whether the `C.BUFFER_FLAG_HAS_SUPPLEMENTAL_DATA` flag is set.
    `boolean` | `isDecodeOnly()` | Returns whether the `C.BUFFER_FLAG_DECODE_ONLY` flag is set.
    `boolean` | `isEndOfStream()` | Returns whether the `C.BUFFER_FLAG_END_OF_STREAM` flag is set.
    `boolean` | `isKeyFrame()` | Returns whether the `C.BUFFER_FLAG_KEY_FRAME` flag is set.
    `void` | `setFlags​(int flags)` | Replaces this buffer's flags with `flags`.

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

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

- - ### Constructor Detail

    - #### Buffer

          public Buffer()

  - ### Method Detail

    - #### clear

          public void clear()

      Clears the buffer.

    - #### isDecodeOnly

          public final boolean isDecodeOnly()

      Returns whether the `C.BUFFER_FLAG_DECODE_ONLY` flag is set.

    - #### isEndOfStream

          public final boolean isEndOfStream()

      Returns whether the `C.BUFFER_FLAG_END_OF_STREAM` flag is set.

    - #### isKeyFrame

          public final boolean isKeyFrame()

      Returns whether the `C.BUFFER_FLAG_KEY_FRAME` flag is set.

    - #### hasSupplementalData

          public final boolean hasSupplementalData()

      Returns whether the `C.BUFFER_FLAG_HAS_SUPPLEMENTAL_DATA` flag is set.

    - #### setFlags

          public final void setFlags​(@BufferFlags
                                     int flags)

      Replaces this buffer's flags with `flags`.
      Parameters:
        `flags` - The flags to set, which should be a combination of the `C.BUFFER_FLAG_*` constants.

    - #### addFlag

          public final void addFlag​(@BufferFlags
                                    int flag)

      Adds the `flag` to this buffer's flags.
      Parameters:
        `flag` - The flag to add to this buffer's flags, which should be one of the `C.BUFFER_FLAG_*` constants.

    - #### clearFlag

          public final void clearFlag​(@BufferFlags
                                      int flag)

      Removes the `flag` from this buffer's flags, if it is set.
      Parameters:
        `flag` - The flag to remove.

    - #### getFlag

          protected final boolean getFlag​(@BufferFlags
                                          int flag)

      Returns whether the specified flag has been set on this buffer.
      Parameters:
        `flag` - The flag to check.
      Returns:
        Whether the flag is set.