T
- The type of the object being loaded.public final class ParsingLoadable<T> extends 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,
Uri uri,
int type,
ParsingLoadable.Parser<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.
|
boolean |
isLoadCanceled()
Returns whether the load has been canceled.
|
void |
load()
Performs the load, returning on completion or cancellation.
|
public final int type
DATA_TYPE_*
constants defined in C
. For
reporting only.public ParsingLoadable(DataSource dataSource, Uri uri, int type, ParsingLoadable.Parser<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 final T getResult()
public long bytesLoaded()
public final void cancelLoad()
Loader.Loadable
cancelLoad
in interface Loader.Loadable
public final boolean isLoadCanceled()
Loader.Loadable
isLoadCanceled
in interface Loader.Loadable
public final void load() throws IOException, InterruptedException
Loader.Loadable
load
in interface Loader.Loadable
IOException
InterruptedException