ThrowingSubtitleParserFactory


@UnstableApi
public class ThrowingSubtitleParserFactory implements SubtitleParser.Factory


A SubtitleParser.Factory for SubtitleParser instances that throw an exception on every call to parse.

It claims support for all subtitle formats (returns the result of isText from supportsFormat).

Summary

Constants

static final int

Public constructors

Public methods

SubtitleParser
create(Format format)

Creates a SubtitleParser for the given Format.

int

Returns the CueReplacementBehavior of the SubtitleParser implementation that handles format.

boolean

Returns whether the factory is able to instantiate a SubtitleParser for the given Format.

Inherited Constants

From androidx.media3.extractor.text.SubtitleParser.Factory
static final SubtitleParser.Factory

A subtitle parser factory that supports no formats.

Constants

REPLACEMENT_BEHAVIOR

@Format.CueReplacementBehavior
public static final int REPLACEMENT_BEHAVIOR = 2

Public constructors

ThrowingSubtitleParserFactory

public ThrowingSubtitleParserFactory(
    Supplier<RuntimeException> exceptionSupplier
)

Public methods

create

public SubtitleParser create(Format format)

Creates a SubtitleParser for the given Format.

Returns
SubtitleParser

The SubtitleParser instance.

Throws
java.lang.IllegalArgumentException

if format is not supported by this factory.

getCueReplacementBehavior

@Format.CueReplacementBehavior
public int getCueReplacementBehavior(Format format)

Returns the CueReplacementBehavior of the SubtitleParser implementation that handles format.

Returns
int

The replacement behavior.

Throws
java.lang.IllegalArgumentException

if format is not supported by this factory.

supportsFormat

public boolean supportsFormat(Format format)

Returns whether the factory is able to instantiate a SubtitleParser for the given Format.

Parameters
Format format

The Format.

Returns
boolean

Whether the factory can instantiate a suitable SubtitleParser.