@UnstableApi
public interface ExtractorInput extends DataReader

Known direct subclasses
DefaultExtractorInput

An ExtractorInput that wraps a DataReader.

FakeExtractorInput

A fake ExtractorInput capable of simulating various scenarios.

ForwardingExtractorInput

An overridable ExtractorInput implementation forwarding all methods to another input.


Provides data to be consumed by an Extractor.

This interface provides two modes of accessing the underlying input. See the subheadings below for more info about each mode.

  • The read()/peek() and skip() methods provide InputStream-like byte-level access operations.
  • The read/skip/peekFully() and advancePeekPosition() methods assume the user wants to read an entire block/frame/header of known length.

InputStream-like methods

The read()/peek() and skip() methods provide InputStream-like byte-level access operations. The length parameter is a maximum, and each method returns the number of bytes actually processed. This may be less than length because the end of the input was reached, or the method was interrupted, or the operation was aborted early for another reason.

Block-based methods

The read/skip/peekFully() and advancePeekPosition() methods assume the user wants to read an entire block/frame/header of known length.

These methods all have a variant that takes a boolean allowEndOfInput parameter. This parameter is intended to be set to true when the caller believes the input might be fully exhausted before the call is made (i.e. they've previously read/skipped/peeked the final block/frame/header). It's not intended to allow a partial read (i.e. greater than 0 bytes, but less than length) to succeed - this will always throw an EOFException from these methods (a partial read is assumed to indicate a malformed block/frame/header - and therefore a malformed file).

The expected behaviour of the block-based methods is therefore:

  • Already at end-of-input and allowEndOfInput=false: Throw EOFException.
  • Already at end-of-input and allowEndOfInput=true: Return