T
- The type of the object being loaded.public final class UriLoadable<T> extends Object implements Loader.Loadable
Loader.Loadable
for loading an object from a URI.Modifier and Type | Class and Description |
---|---|
static interface |
UriLoadable.Parser<T>
Parses an object from loaded data.
|
Constructor and Description |
---|
UriLoadable(String url,
UriDataSource uriDataSource,
UriLoadable.Parser<T> parser) |
Modifier and Type | Method and Description |
---|---|
void |
cancelLoad()
Cancels the load.
|
T |
getResult()
Returns the loaded object, or null if an object has not been loaded.
|
boolean |
isLoadCanceled()
Whether the load has been canceled.
|
void |
load()
Performs the load, returning on completion or cancelation.
|
public UriLoadable(String url, UriDataSource uriDataSource, UriLoadable.Parser<T> parser)
url
- The url from which the object should be loaded.uriDataSource
- A UriDataSource
to use when loading the data.parser
- Parses the object from the response.public final T getResult()
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