net.sf.asyncobjects.io.util
Class BoundedInput<D extends BatchedData<D>,I extends AInput<D>>
java.lang.Object
net.sf.asyncobjects.AsyncUnicastServer<FacetType>
net.sf.asyncobjects.util.CloseableWrapper<I,I>
net.sf.asyncobjects.io.util.BoundedInput<D,I>
- Type Parameters:
D - a batched data typeI - an input type
- All Implemented Interfaces:
- ACloseable, AsyncObject, ExplicitSharing, AInput<D>
- Direct Known Subclasses:
- BoundedByteInput, BoundedTextInput
public class BoundedInput<D extends BatchedData<D>,I extends AInput<D>>
- extends CloseableWrapper<I,I>
- implements AInput<D>
Input that allows to read at most the specified length. After that, EOF
is returned.
- Author:
- const
|
Constructor Summary |
BoundedInput(I in,
boolean closeStream,
long remaining)
A constructor |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
BoundedInput
public BoundedInput(I in,
boolean closeStream,
long remaining)
- A constructor
- Parameters:
in - input stream to limitcloseStream - if true underlying stream is closed on close stream operationremaining - remaining elements allowed to be read in the stream.
read
public Promise<D> read(int limit)
- Read data
- Specified by:
read in interface AInput<D extends BatchedData<D>>
- Parameters:
limit - a limit for data to read
- Returns:
- a promise for read data
- See Also:
AInput.read(int)
isPushbackSupported
public Promise<Boolean> isPushbackSupported()
- Specified by:
isPushbackSupported in interface AInput<D extends BatchedData<D>>
- Returns:
- true if pushback supported for this stream
- See Also:
AInput.isPushbackSupported()
pushback
public Promise<Void> pushback(D data)
- Pushback data
- Specified by:
pushback in interface AInput<D extends BatchedData<D>>
- Parameters:
data - a data to push back
- Returns:
- when pushback finished
- See Also:
AInput.pushback(net.sf.asyncobjects.io.BatchedData)
Copyright © 2002-2007 Constantine Plotnikov. All Rights Reserved.