public final class BaasAsset
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static RequestToken |
fetchData(java.lang.String id,
BaasHandler<JsonObject> handler)
Asynchronously retrieves named assets data,
If the named asset is a document, the document is retrieved
otherwise attached data to the file are returned.
|
static RequestToken |
fetchData(java.lang.String id,
int flags,
BaasHandler<JsonObject> handler)
Asynchronously retrieves named assets data,
If the named asset is a document, the document is retrieved
otherwise attached data to the file are returned.
|
static BaasResult<JsonObject> |
fetchDataSync(java.lang.String id)
Synchronously retrieves named assets data,
If the named asset is a document, the document is retrieved
otherwise attached data to the file are returned.
|
static RequestToken |
streamAsset(java.lang.String id,
BaasHandler<byte[]> handler) |
static <R> RequestToken |
streamAsset(java.lang.String id,
DataStreamHandler<R> data,
BaasHandler<R> handler)
Streams the file using the provided data stream handler.
|
static <R> RequestToken |
streamAsset(java.lang.String id,
int flags,
DataStreamHandler<R> contentHandler,
BaasHandler<R> handler)
Streams the file using the provided data stream handler.
|
static <R> RequestToken |
streamImageAsset(java.lang.String id,
int size,
DataStreamHandler<R> data,
BaasHandler<R> handler)
Streams the file using the provided data stream handler.
|
static <R> RequestToken |
streamImageAsset(java.lang.String id,
int size,
int flags,
DataStreamHandler<R> data,
BaasHandler<R> handler)
Streams the file using the provided data stream handler.
|
static BaasResult<BaasStream> |
streamImageAssetSync(java.lang.String id,
int sizeId)
Synchronously streams the asset.
|
static BaasResult<BaasStream> |
streamImageAssetSync(java.lang.String id,
java.lang.String spec)
Synchronously streams the asset.
|
public static RequestToken fetchData(java.lang.String id, BaasHandler<JsonObject> handler)
id
- the name of the assethandler
- an handler that will be handed the responsepublic static RequestToken fetchData(java.lang.String id, int flags, BaasHandler<JsonObject> handler)
id
- the name of the assetflags
- used for the request a bit or of RequestOptions
constantshandler
- an handler that will be handed the responsepublic static BaasResult<JsonObject> fetchDataSync(java.lang.String id)
id
- the name of the assetpublic static RequestToken streamAsset(java.lang.String id, BaasHandler<byte[]> handler)
public static <R> RequestToken streamAsset(java.lang.String id, DataStreamHandler<R> data, BaasHandler<R> handler)
R
- the type to transform the bytes to.id
- the name of the asset to downloaddata
- the data stream handler DataStreamHandler
handler
- the completion handlerpublic static <R> RequestToken streamImageAsset(java.lang.String id, int size, DataStreamHandler<R> data, BaasHandler<R> handler)
R
- the type to transform the bytes to.id
- the name of the asset to downloadsize
- a size spec to specify the resize of an image assetdata
- the data stream handler DataStreamHandler
handler
- the completion handlerpublic static <R> RequestToken streamAsset(java.lang.String id, int flags, DataStreamHandler<R> contentHandler, BaasHandler<R> handler)
R
- the type to transform the bytes to.id
- the name of the asset to downloadflags
- handler
- the completion handlerpublic static <R> RequestToken streamImageAsset(java.lang.String id, int size, int flags, DataStreamHandler<R> data, BaasHandler<R> handler)
R
- the type to transform the bytes to.id
- the name of the asset to downloadsize
- a size spec to specify the resize of an image assetflags
- RequestOptions
data
- the data stream handler DataStreamHandler
handler
- the completion handlerpublic static BaasResult<BaasStream> streamImageAssetSync(java.lang.String id, java.lang.String spec)
id
- the name of the asset to downloadspec
- a size spec to specify the resize of an image assetBaasStream
wrapped in a resultpublic static BaasResult<BaasStream> streamImageAssetSync(java.lang.String id, int sizeId)
id
- the name of the asset to downloadsizeId
- the size index if the asset is an imageBaasStream
wrapped in a result