net.sf.asyncobjects.io
Class WrappingChannel<D extends BatchedData<D>,I extends AInput<D>,O extends AOutput<D>,C extends AChannel<D,I,O>>

java.lang.Object
  extended by net.sf.asyncobjects.AsyncUnicastServer<C>
      extended by net.sf.asyncobjects.io.WrappingChannel<D,I,O,C>
Type Parameters:
D - a batched data type
I - an input type
O - an output type
C - a channel type
All Implemented Interfaces:
ACloseable, AsyncObject, ExplicitSharing, AChannel<D,I,O>
Direct Known Subclasses:
BufferedByteChannel, BufferedTextChannel

public abstract class WrappingChannel<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>

Byte channel that wraps existing channel some functionality over it.

Author:
const

Field Summary
protected  I in
          an input
protected  O out
          and output
protected  C wrapped
          a wrapped byte channel
 
Constructor Summary
WrappingChannel(C wrapped)
          A constructor
 
Method Summary
 Promise<Void> close()
          Close resource
 Promise<I> getInput()
           
 Promise<O> getOutput()
           
protected abstract  I wrap(I input)
          Wrap input into buffered stream
protected abstract  O wrap(O output)
          Wrap output into buffered stream
 
Methods inherited from class net.sf.asyncobjects.AsyncUnicastServer
dereference, export, isImmediate, myVat, promise
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.sf.asyncobjects.AsyncObject
dereference, isImmediate
 

Field Detail

wrapped

protected final C extends AChannel<D,I,O> wrapped
a wrapped byte channel


in

protected I extends AInput<D> in
an input


out

protected O extends AOutput<D> out
and output

Constructor Detail

WrappingChannel

public WrappingChannel(C wrapped)
A constructor

Parameters:
wrapped - a wrapped channel
Method Detail

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 of the channel
See Also:
AChannel.getInput()

wrap

protected abstract I wrap(I input)
Wrap input into buffered stream

Parameters:
input - an input to wrap
Returns:
a buffered stream

getOutput

public Promise<O> getOutput()
Specified by:
getOutput in interface AChannel<D extends BatchedData<D>,I extends AInput<D>,O extends AOutput<D>>
Returns:
ouput of the channel
See Also:
AChannel.getOutput()

wrap

protected abstract O wrap(O output)
Wrap output into buffered stream

Parameters:
output - an output
Returns:
wrapped stream

close

public Promise<Void> close()
Description copied from interface: ACloseable
Close resource

Specified by:
close in interface ACloseable
Returns:
a promise that resolves when object is closed.
See Also:
ACloseable.close()


Copyright © 2002-2007 Constantine Plotnikov. All Rights Reserved.