Humboldt Alignment Editor 2.5.0

eu.esdihumboldt.hale.common.core.io.supplier
Class LookupStreamResource

java.lang.Object
  extended by eu.esdihumboldt.hale.common.core.io.supplier.LookupStreamResource

public class LookupStreamResource
extends Object

Provides input supplier based on a single input stream, that allow to consume it multiple times up to a limit in read bytes (see getLookupSupplier()), and once completely (see getInputSupplier()). For the underlying input stream to be closed, the input stream provided by getInputSupplier() must be closed.

Author:
Simon Templer

Constructor Summary
LookupStreamResource(InputStream input, URI location, int lookupLimit)
          Constructor.
 
Method Summary
 LocatableInputSupplier<? extends InputStream> getInputSupplier()
          Get an input supplier that supplies the underlying stream, which can be fully consumed only once.
 LocatableInputSupplier<? extends InputStream> getLookupSupplier()
          Get an input supplier that supplies streams that may only be read to a certain amount of bytes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LookupStreamResource

public LookupStreamResource(InputStream input,
                            URI location,
                            int lookupLimit)
Constructor.

Parameters:
input - the input stream
location - the location represented by the input stream, may be null
lookupLimit - the limit of bytes that may be read from a lookup input stream
Method Detail

getLookupSupplier

public LocatableInputSupplier<? extends InputStream> getLookupSupplier()
Get an input supplier that supplies streams that may only be read to a certain amount of bytes. Only one instance of such a stream may be used at a time (as they are all backed by the same stream) and the instance should be closed before the stream is retrieved through getInputSupplier().

Returns:
the input supplier

getInputSupplier

public LocatableInputSupplier<? extends InputStream> getInputSupplier()
Get an input supplier that supplies the underlying stream, which can be fully consumed only once.

Returns:
the input supplier

Humboldt Alignment Editor 2.5.0

Build 2012-12-03_12-30-59
Revision 9d2dd4b0318cda9f1393b1ddd390f7f792d70a2d