You are viewing an old version of this page. View the current version.
Compare with Current
View Page History
Version 1
Next »
Fetching a single blob:
Resource stream = Resource.createUriRef("urn:stream");
BlobFetcher bf = new BlobFetcher();
bf.setSubject(TimeAnnotatedResource.create(stream,
TemporalAnnotation.getInstant(2)));
context.perform(bf);
//read the data and do something with it
processBlob(bf.getInputStream());
Fetching blobs in an interval:
Resource stream = Resource.createUriRef("urn:stream");
TimeAnnotatedBlobFetcher bf = new TimeAnnotatedBlobFetcher(
TimeAnnotatedResource.create(stream,
TemporalAnnotation.getInterval(0,100 )));
context.perform(bf);
for(Pair<TemporalAnnotation,InputStream> blob:bf){
//read the data and do something with it
TemporalAnnotation time = blob._1;
InputStream data = blob._2;
...
}