public class ChunkStreamer
extends java.lang.Object
Constructor and Description |
---|
ChunkStreamer(HapiService service,
int chunkLimit,
IOConsumer<java.lang.String> limitCallback)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
int |
getChunkLimit()
Returns the largest number of chunks that this streamer is prepared
to request for a given download.
|
java.io.InputStream |
openMultiChunkStream(java.net.URL requestUrl)
Returns an input stream corresponding to the supplied HAPI data request
URL, but which may be assembled from the concatenation of
multiple actual requests to the service.
|
public ChunkStreamer(HapiService service, int chunkLimit, IOConsumer<java.lang.String> limitCallback)
A limit must be supplied for the maximum number of chunks that will be retrieved for a given request. If this limit is exceeded, the supplied callback object, if any, will be called and the stream will terminate. If the callback throws an IOException, it will be encountered by the code reading the stream.
service
- service to which requests will be madechunkLimit
- maximum number of chunks that a data stream will
includelimitCallback
- called with a failure message
if chunk limit is exceeded; may be nullpublic int getChunkLimit()
public java.io.InputStream openMultiChunkStream(java.net.URL requestUrl) throws java.io.IOException
requestUrl
- data request URLjava.io.IOException