T - The type of the object being loaded.public final class ParsingLoadable<T> extends java.lang.Object implements Loader.Loadable
Loader.Loadable for objects that can be parsed from binary data using a ParsingLoadable.Parser.| Modifier and Type | Class and Description |
|---|---|
static interface |
ParsingLoadable.Parser<T>
Parses an object from loaded data.
|
| Modifier and Type | Field and Description |
|---|---|
DataSpec |
dataSpec
The
DataSpec that defines the data to be loaded. |
int |
type
The type of the data.
|
| Constructor and Description |
|---|
ParsingLoadable(DataSource dataSource,
DataSpec dataSpec,
int type,
ParsingLoadable.Parser<? extends T> parser) |
ParsingLoadable(DataSource dataSource,
android.net.Uri uri,
int type,
ParsingLoadable.Parser<? extends T> parser) |
| Modifier and Type | Method and Description |
|---|---|
long |
bytesLoaded()
Returns the number of bytes loaded.
|
void |
cancelLoad()
Cancels the load.
|
T |
getResult()
Returns the loaded object, or null if an object has not been loaded.
|
void |
load()
Performs the load, returning on completion or cancellation.
|
static <T> T |
load(DataSource dataSource,
ParsingLoadable.Parser<? extends T> parser,
android.net.Uri uri)
Loads a single parsable object.
|
public final int type
DATA_TYPE_* constants defined in C. For
reporting only.public ParsingLoadable(DataSource dataSource, android.net.Uri uri, int type, ParsingLoadable.Parser<? extends T> parser)
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.public ParsingLoadable(DataSource dataSource, DataSpec dataSpec, int type, ParsingLoadable.Parser<? extends T> parser)
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.public static <T> T load(DataSource dataSource, ParsingLoadable.Parser<? extends T> parser, android.net.Uri uri) throws java.io.IOException
dataSource - The DataSource through which the object should be read.uri - The Uri of the object to read.java.io.IOException - Thrown if there is an error while loading or parsing.public final T getResult()
public long bytesLoaded()
public final void cancelLoad()
Loader.LoadablecancelLoad in interface Loader.Loadablepublic final void load()
throws java.io.IOException
Loader.Loadableload in interface Loader.Loadablejava.io.IOException - If the input could not be loaded.