Back to Exoplayer

ParsingLoadable (ExoPlayer library)

docs/doc/reference/com/google/android/exoplayer2/upstream/ParsingLoadable.html

latest12.1 KB
Original Source

Package com.google.android.exoplayer2.upstream

Class ParsingLoadable<T>

  • java.lang.Object

    • com.google.android.exoplayer2.upstream.ParsingLoadable<T>
  • Type Parameters:T - The type of the object being loaded.All Implemented Interfaces:Loader.Loadable


[@Deprecated](https://developer.android.com/reference/java/lang/Deprecated.html "class or interface in java.lang")public final classParsingLoadable\<T\>extends[Object](https://developer.android.com/reference/java/lang/Object.html "class or interface in java.lang")implements[Loader.Loadable](Loader.Loadable.html "interface in com.google.android.exoplayer2.upstream")

Deprecated. com.google.android.exoplayer2 is deprecated. Please migrate to androidx.media3 (which contains the same ExoPlayer code). See the migration guide for more details, including a script to help with the migration.

A Loader.Loadable for objects that can be parsed from binary data using a ParsingLoadable.Parser.

Nested Class Summary

Nested Classes | Modifier and Type | Class | Description | | --- | --- | --- | | static interface | ParsingLoadable.Parser<T> | Deprecated.

Parses an object from loaded data. |

Field Summary

Fields | Modifier and Type | Field | Description | | --- | --- | --- | | DataSpec | dataSpec | Deprecated.

The DataSpec that defines the data to be loaded. | | long | loadTaskId | Deprecated.

Identifies the load task for this loadable. | | int | type | Deprecated.

The type of the data. |

Constructor Summary

Constructors | Constructor | Description | | --- | --- | | ParsingLoadable​(DataSource dataSource, Uri uri, int type, ParsingLoadable.Parser<? extends T> parser) | Deprecated. | | ParsingLoadable​(DataSource dataSource, DataSpec dataSpec, int type, ParsingLoadable.Parser<? extends T> parser) | Deprecated. |

Method Summary

All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods | Modifier and Type | Method | Description | | --- | --- | --- | | long | bytesLoaded() | Deprecated.

Returns the number of bytes loaded. | | void | cancelLoad() | Deprecated.

Cancels the load. | | Map<String,​List<String>> | getResponseHeaders() | Deprecated.

Returns the response headers associated with the load. | | T | getResult() | Deprecated.

Returns the loaded object, or null if an object has not been loaded. | | Uri | getUri() | Deprecated.

Returns the Uri from which data was read. | | void | load() | Deprecated.

Performs the load, returning on completion or cancellation. | | static <T> T | load​(DataSource dataSource, ParsingLoadable.Parser<? extends T> parser, Uri uri, int type) | Deprecated.

Loads a single parsable object. | | static <T> T | load​(DataSource dataSource, ParsingLoadable.Parser<? extends T> parser, DataSpec dataSpec, int type) | Deprecated.

Loads a single parsable object. |

- 

Methods inherited from class java.lang.Object

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

Field Detail

- 

loadTaskId

public final long loadTaskId

Deprecated.

Identifies the load task for this loadable.

- 

dataSpec

public final[DataSpec](DataSpec.html "class in com.google.android.exoplayer2.upstream")dataSpec

Deprecated.

The DataSpec that defines the data to be loaded.

- 

type

public final int type

Deprecated.

The type of the data. One of the DATA_TYPE_* constants defined in C. For reporting only.

Constructor Detail

- 

ParsingLoadable

public ParsingLoadable​([DataSource](DataSource.html "interface in com.google.android.exoplayer2.upstream")dataSource,[Uri](https://developer.android.com/reference/android/net/Uri.html "class or interface in android.net")uri,
                       int type,[ParsingLoadable.Parser](ParsingLoadable.Parser.html "interface in com.google.android.exoplayer2.upstream")<? extends[T](ParsingLoadable.html "type parameter in ParsingLoadable")> parser)

Deprecated. Parameters:dataSource - A DataSource to use when loading the data.uri - The Uri from which the object should be loaded.type - See type.parser - Parses the object from the response.

- 

ParsingLoadable

public ParsingLoadable​([DataSource](DataSource.html "interface in com.google.android.exoplayer2.upstream")dataSource,[DataSpec](DataSpec.html "class in com.google.android.exoplayer2.upstream")dataSpec,
                       int type,[ParsingLoadable.Parser](ParsingLoadable.Parser.html "interface in com.google.android.exoplayer2.upstream")<? extends[T](ParsingLoadable.html "type parameter in ParsingLoadable")> parser)

Deprecated. Parameters:dataSource - A DataSource to use when loading the data.dataSpec - The DataSpec from which the object should be loaded.type - See type.parser - Parses the object from the response.

Method Detail

- 

load

public static <T> T load​([DataSource](DataSource.html "interface in com.google.android.exoplayer2.upstream")dataSource,[ParsingLoadable.Parser](ParsingLoadable.Parser.html "interface in com.google.android.exoplayer2.upstream")<? extends T> parser,[Uri](https://developer.android.com/reference/android/net/Uri.html "class or interface in android.net")uri,
                         int type)
                  throws[IOException](https://developer.android.com/reference/java/io/IOException.html "class or interface in java.io")

Deprecated.

Loads a single parsable object. Parameters:dataSource - The DataSource through which the object should be read.parser - The ParsingLoadable.Parser to parse the object from the response.uri - The Uri of the object to read.type - The type of the data. One of the CDATA_TYPE_* constants.Returns:The parsed objectThrows:IOException - Thrown if there is an error while loading or parsing.

- 

load

public static <T> T load​([DataSource](DataSource.html "interface in com.google.android.exoplayer2.upstream")dataSource,[ParsingLoadable.Parser](ParsingLoadable.Parser.html "interface in com.google.android.exoplayer2.upstream")<? extends T> parser,[DataSpec](DataSpec.html "class in com.google.android.exoplayer2.upstream")dataSpec,
                         int type)
                  throws[IOException](https://developer.android.com/reference/java/io/IOException.html "class or interface in java.io")

Deprecated.

Loads a single parsable object. Parameters:dataSource - The DataSource through which the object should be read.parser - The ParsingLoadable.Parser to parse the object from the response.dataSpec - The DataSpec of the object to read.type - The type of the data. One of the CDATA_TYPE_* constants.Returns:The parsed objectThrows:IOException - Thrown if there is an error while loading or parsing.

- 

getResult

@Nullable
public final[T](ParsingLoadable.html "type parameter in ParsingLoadable")getResult()

Deprecated.

Returns the loaded object, or null if an object has not been loaded.

- 

bytesLoaded

public long bytesLoaded()

Deprecated.

Returns the number of bytes loaded. In the case that the network response was compressed, the value returned is the size of the data after decompression. Must only be called after the load completed, failed, or was canceled.

- 

getUri

public[Uri](https://developer.android.com/reference/android/net/Uri.html "class or interface in android.net")getUri()

Deprecated.

Returns the Uri from which data was read. If redirection occurred, this is the redirected uri. Must only be called after the load completed, failed, or was canceled.

- 

getResponseHeaders

public[Map](https://developer.android.com/reference/java/util/Map.html "class or interface in java.util")<[String](https://developer.android.com/reference/java/lang/String.html?is-external=true "class or interface in java.lang"),​[List](https://developer.android.com/reference/java/util/List.html?is-external=true "class or interface in java.util")<[String](https://developer.android.com/reference/java/lang/String.html?is-external=true "class or interface in java.lang")>> getResponseHeaders()

Deprecated.

Returns the response headers associated with the load. Must only be called after the load completed, failed, or was canceled.

- 

cancelLoad

public final void cancelLoad()

Deprecated.

Description copied from interface: Loader.Loadable

Cancels the load.

Loadable implementations should ensure that a currently executing Loader.Loadable.load() call will exit reasonably quickly after this method is called. The Loader.Loadable.load() call may exit either by returning or by throwing an IOException.

If there is a currently executing Loader.Loadable.load() call, then the thread on which that call is being made will be interrupted immediately after the call to this method. Hence implementations do not need to (and should not attempt to) interrupt the loading thread themselves.

Although the loading thread will be interrupted, Loadable implementations should not use the interrupted status of the loading thread in Loader.Loadable.load() to determine whether the load has been canceled. This approach is not robust [Internal ref: b/79223737]. Instead, implementations should use their own flag to signal cancelation (for example, using AtomicBoolean).

Specified by:cancelLoad in interface Loader.Loadable

- 

load

public final void load()
                throws[IOException](https://developer.android.com/reference/java/io/IOException.html "class or interface in java.io")

Deprecated.

Description copied from interface: Loader.Loadable

Performs the load, returning on completion or cancellation. Specified by:load in interface Loader.LoadableThrows:IOException - If the input could not be loaded.