net.sf.asyncobjects.io.adapters
Class OutputStreamAdapter

java.lang.Object
  extended by net.sf.asyncobjects.AsyncUnicastServer<AByteOutput>
      extended by net.sf.asyncobjects.io.adapters.OutputStreamAdapter
All Implemented Interfaces:
ACloseable, AsyncObject, ExplicitSharing, AByteOutput, AOutput<BinaryData>
Direct Known Subclasses:
TSocket.TOutputStreamAdapter

public class OutputStreamAdapter
extends AsyncUnicastServer<AByteOutput>
implements AByteOutput

An adapter for output stream

Author:
const

Constructor Summary
OutputStreamAdapter(OutputStream out)
          A constructor
OutputStreamAdapter(OutputStream out, int bufferSize)
          A constructor
 
Method Summary
 Promise<Void> close()
          close stream
 Promise<Void> flush()
          Flush output
 Promise<Void> write(BinaryData data)
          Write data to 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
 

Constructor Detail

OutputStreamAdapter

public OutputStreamAdapter(OutputStream out)
A constructor

Parameters:
out - wrapped output stream

OutputStreamAdapter

public OutputStreamAdapter(OutputStream out,
                           int bufferSize)
A constructor

Parameters:
out - wrapped ouput stream
bufferSize - a buffer size
Method Detail

write

public Promise<Void> write(BinaryData data)
Write data to stream

Specified by:
write in interface AOutput<BinaryData>
Parameters:
data - a data to write
Returns:
a promise that resolves when pipe is ready for further writing
See Also:
AOutput.write(net.sf.asyncobjects.io.BatchedData)

flush

public Promise<Void> flush()
Flush output

Specified by:
flush in interface AOutput<BinaryData>
Returns:
a promise that will resolve when data will be written out
See Also:
AOutput.flush()

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()


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