@UnstableApi
public abstract class Buffer

Known direct subclasses
DecoderInputBuffer

Holds input for a decoder.

DecoderOutputBuffer

Output buffer decoded by a Decoder.


Base class for buffers with flags.

Summary

Public constructors

Public methods

final void

Adds the flag to this buffer's flags.

void

Clears the buffer.

final void

Removes the flag from this buffer's flags, if it is set.

final boolean

Returns whether the BUFFER_FLAG_HAS_SUPPLEMENTAL_DATA flag is set.

final boolean

Returns whether the BUFFER_FLAG_END_OF_STREAM flag is set.

final boolean

Returns whether the BUFFER_FLAG_FIRST_SAMPLE flag is set.

final boolean

Returns whether the BUFFER_FLAG_KEY_FRAME flag is set.

final boolean

Returns whether the BUFFER_FLAG_LAST_SAMPLE flag is set.

final boolean

Returns whether the BUFFER_FLAG_NOT_DEPENDED_ON flag is set.

final void
setFlags(@C.BufferFlags int flags)

Replaces this buffer's flags with flags.

Protected methods

final boolean

Returns whether the specified flag has been set on this buffer.

Public constructors

Buffer

public Buffer()

Public methods

addFlag

public final void addFlag(@C.BufferFlags int flag)

Adds the flag to this buffer's flags.

Parameters
@C.BufferFlags int flag

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

clear

@CallSuper
public void clear()

Clears the buffer.

clearFlag

public final void clearFlag(@C.BufferFlags int flag)

Removes the flag from this buffer's flags, if it is set.

Parameters
@C.BufferFlags int flag

The flag to remove.

hasSupplementalData

public final boolean hasSupplementalData()

Returns whether the BUFFER_FLAG_HAS_SUPPLEMENTAL_DATA flag is set.

isEndOfStream

public final boolean isEndOfStream()

Returns whether the BUFFER_FLAG_END_OF_STREAM flag is set.

If this is set, all other attributes of the buffer should be ignored.

isFirstSample

public final boolean isFirstSample()

Returns whether the BUFFER_FLAG_FIRST_SAMPLE flag is set.

isKeyFrame

public final boolean isKeyFrame()

Returns whether the BUFFER_FLAG_KEY_FRAME flag is set.

isLastSample

public final boolean isLastSample()

Returns whether the BUFFER_FLAG_LAST_SAMPLE flag is set.

notDependedOn

public final boolean notDependedOn()

Returns whether the BUFFER_FLAG_NOT_DEPENDED_ON flag is set.

setFlags

public final void setFlags(@C.BufferFlags int flags)

Replaces this buffer's flags with flags.

Parameters
@C.BufferFlags int flags

The flags to set, which should be a combination of the C.BUFFER_FLAG_* constants.

Protected methods

getFlag

protected final boolean getFlag(@C.BufferFlags int flag)

Returns whether the specified flag has been set on this buffer.

Parameters
@C.BufferFlags int flag

The flag to check.

Returns
boolean

Whether the flag is set.