net.sf.asyncobjects.io
Interface AInput<D extends BatchedData<D>>

Type Parameters:
D - a bached data type
All Superinterfaces:
ACloseable, AsyncObject
All Known Subinterfaces:
AByteInput, ATextInput
All Known Implementing Classes:
BoundedByteInput, BoundedInput, BoundedTextInput, BufferedByteInput, BufferedInput, BufferedTextInput, BytePipe.InternalBytePipeInput, DecoderTextInput, ExhaustingByteInput, ExhaustingInput, ExhaustingTextInput, GeneratingInput, InputStreamAdapter, NIOSocketInputStream, NulByteInput, NulInput, NulTextInput, Pipe.InternalPipeInput, RandomByteInput, RandomTextInput, RepeatingByteInput, RepeatingInput, RepeatingTextInput, SavingByteInput, SavingInput, SavingTextInput, TextPipe.InternalTextPipeInput, TSocket.TInputStreamAdapter, UncloseableByteInput, UncloseableInput, UncloseableTextInput

public interface AInput<D extends BatchedData<D>>
extends ACloseable

A generic input interface

Author:
const

Method Summary
 Promise<Boolean> isPushbackSupported()
           
 Promise<Void> pushback(D data)
          Attempt to return some data to stream.
 Promise<D> read(int limit)
          Read some data.
 
Methods inherited from interface net.sf.asyncobjects.ACloseable
close
 
Methods inherited from interface net.sf.asyncobjects.AsyncObject
dereference, isImmediate
 

Method Detail

read

Promise<D> read(int limit)
Read some data.

Parameters:
limit - a maximum amount of data elements to read.
Returns:
Promise for non-empty data batch that contains read inforation or null if eof is reached.

pushback

Promise<Void> pushback(D data)
Attempt to return some data to stream. Most streams do not support this operation. Note that pushback operation has the same priority as read operation.

Parameters:
data - a data to unread.
Returns:
a promise for null or exception if stream does not supports unreading.

isPushbackSupported

Promise<Boolean> isPushbackSupported()
Returns:
true if pushback supported for this stream


Copyright 2002-2007 Constantine Plotnikov. All Rights Reserved.