net.sf.asyncobjects.io
Class Pipe<D extends BatchedData<D>,I extends AInput<D>,O extends AOutput<D>,C extends AChannel<D,I,O>>
java.lang.Object
net.sf.asyncobjects.AsyncUnicastServer<C>
net.sf.asyncobjects.io.Pipe<D,I,O,C>
- Type Parameters:
D
- a batched data typeI
- an input typeO
- an output typeC
- a channel type
- All Implemented Interfaces:
- ACloseable, AsyncObject, ExplicitSharing, AChannel<D,I,O>
- Direct Known Subclasses:
- BytePipe, TextPipe
public abstract class Pipe<D extends BatchedData<D>,I extends AInput<D>,O extends AOutput<D>,C extends AChannel<D,I,O>>
- extends AsyncUnicastServer<C>
- implements AChannel<D,I,O>
A pipe is pair of output stream and input stream, what is written to output
stream, could be later read from input stream. The object supports
AChannel
interface. Note that input supports
AInput.pushback(BatchedData)
operation.
- See Also:
AChannel
Constructor Summary |
Pipe(int size)
make a pipe |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Pipe
public Pipe(int size)
- make a pipe
- Parameters:
size
- buffer size for pipe
createOutput
protected abstract O createOutput()
- Returns:
- an created output
createInput
protected abstract I createInput()
- Returns:
- an created input
getInput
public Promise<I> getInput()
- Specified by:
getInput
in interface AChannel<D extends BatchedData<D>,I extends AInput<D>,O extends AOutput<D>>
- Returns:
- input stream
- See Also:
AChannel.getInput()
getOutput
public Promise<O> getOutput()
- Specified by:
getOutput
in interface AChannel<D extends BatchedData<D>,I extends AInput<D>,O extends AOutput<D>>
- Returns:
- output stream
- See Also:
AChannel.getOutput()
pushback
public Promise<Void> pushback(D pushbackData)
- Push data back to the pipe
- Parameters:
pushbackData
- a data to push backk
- Returns:
- a promise that resolves when operation finishes
close
public Promise<Void> close()
- Channel close
- Specified by:
close
in interface ACloseable
- Returns:
- proimse that resolves when channle is closed.
Copyright © 2002-2007 Constantine Plotnikov. All Rights Reserved.