net.sf.asyncobjects.net.nio
Class NIOSocketInputStream

java.lang.Object
  extended by net.sf.asyncobjects.AsyncUnicastServer<T>
      extended by net.sf.asyncobjects.net.nio.NIOStream<AByteInput>
          extended by net.sf.asyncobjects.net.nio.NIOSocketInputStream
All Implemented Interfaces:
ACloseable, AsyncObject, ExplicitSharing, AByteInput, AInput<BinaryData>

public class NIOSocketInputStream
extends NIOStream<AByteInput>
implements AByteInput

implementation of stream for sockets


Field Summary
 
Fields inherited from class net.sf.asyncobjects.net.nio.NIOStream
isClosed
 
Method Summary
 Promise<Boolean> isPushbackSupported()
           
 Promise<Void> pushback(BinaryData data)
          Push back data
 Promise<BinaryData> read(int limit)
          Read some bytes.
protected  void shutdownStream()
          Shutdown stream
 
Methods inherited from class net.sf.asyncobjects.net.nio.NIOStream
awake, close, ensureOpen, getDirectBuffer, returnDirectBuffer
 
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.ACloseable
close
 
Methods inherited from interface net.sf.asyncobjects.AsyncObject
dereference, isImmediate
 

Method Detail

read

public Promise<BinaryData> read(int limit)
Read some bytes.

Specified by:
read in interface AInput<BinaryData>
Parameters:
limit - a maximum amount of bytes to read
Returns:
Promise for data, null means EOF.
See Also:
AInput.read(int)

shutdownStream

protected void shutdownStream()
                       throws IOException
Description copied from class: NIOStream
Shutdown stream

Specified by:
shutdownStream in class NIOStream<AByteInput>
Throws:
IOException - if there is a problem with shutdowing
See Also:
NIOStream.shutdownStream()

isPushbackSupported

public Promise<Boolean> isPushbackSupported()
Specified by:
isPushbackSupported in interface AInput<BinaryData>
Returns:
true if pushback supported for this stream
See Also:
AInput.isPushbackSupported()

pushback

public Promise<Void> pushback(BinaryData data)
Push back data

Specified by:
pushback in interface AInput<BinaryData>
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.