net.sf.asyncobjects.io.adapters
Class InputStreamAdapter

java.lang.Object
  extended by net.sf.asyncobjects.AsyncUnicastServer<AByteInput>
      extended by net.sf.asyncobjects.io.adapters.InputStreamAdapter
All Implemented Interfaces:
ACloseable, AsyncObject, ExplicitSharing, AByteInput, AInput<BinaryData>
Direct Known Subclasses:
TSocket.TInputStreamAdapter

public class InputStreamAdapter
extends AsyncUnicastServer<AByteInput>
implements AByteInput

Adapter for input stream

Author:
const

Constructor Summary
InputStreamAdapter(InputStream in)
          A constructor
InputStreamAdapter(InputStream in, int bufferSize)
          A constructor
 
Method Summary
 Promise<Void> close()
          close stream
 Promise<Boolean> isPushbackSupported()
           
 Promise<Void> pushback(BinaryData data)
          Pushback data
 Promise<BinaryData> read(int limit)
          read some bytes
 
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
 

Constructor Detail

InputStreamAdapter

public InputStreamAdapter(InputStream in)
A constructor

Parameters:
in - input stream to wrap

InputStreamAdapter

public InputStreamAdapter(InputStream in,
                          int bufferSize)
A constructor

Parameters:
in - input stream to wrap
bufferSize - a buffer size
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 data expected by client.
Returns:
Promise for read data or null (if eof)
See Also:
AInput.read(int)

close

public Promise<Void> close()
close stream

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

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)
Pushback 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.