net.sf.asyncobjects.io.util
Class RecordingOutput<D extends BatchedData<D>,O extends AOutput<D>>

java.lang.Object
  extended by net.sf.asyncobjects.AsyncUnicastServer<O>
      extended by net.sf.asyncobjects.io.util.RecordingOutput<D,O>
Type Parameters:
D - a data type
O - a facet type
All Implemented Interfaces:
ACloseable, AsyncObject, ExplicitSharing, AOutput<D>
Direct Known Subclasses:
RecordingByteOutput, RecordingTextOutput

public class RecordingOutput<D extends BatchedData<D>,O extends AOutput<D>>
extends AsyncUnicastServer<O>
implements AOutput<D>

The output that recordes what is written into it. It is most useful for test suits.

Author:
const

Constructor Summary
RecordingOutput(D initialData)
          A constructor
 
Method Summary
 Promise<Void> close()
          Close resource
 Promise<D> dataPromise()
           
 Promise<Void> flush()
          Flush data in stream, upon return of this method all data will be written out to most underlying layer
 Promise<Void> write(D data)
          This method writes out the data.
 
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

RecordingOutput

public RecordingOutput(D initialData)
A constructor

Parameters:
initialData - an intial state (it must not be null)
Method Detail

flush

public Promise<Void> flush()
Description copied from interface: AOutput
Flush data in stream, upon return of this method all data will be written out to most underlying layer

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

write

public Promise<Void> write(D data)
Description copied from interface: AOutput
This method writes out the data. Upon resolving promise, the output will be ready to accept next porition of data.

Specified by:
write in interface AOutput<D extends BatchedData<D>>
Parameters:
data - data to write out
Returns:
a promise that resolves to null when stream is ready for next operation.
See Also:
AOutput.write(net.sf.asyncobjects.io.BatchedData)

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

dataPromise

public Promise<D> dataPromise()
Returns:
data promise for this output


Copyright 2002-2007 Constantine Plotnikov. All Rights Reserved.