|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object | +--uk.org.ogsadai.activity.CallThroughPipe
This is a simple unsynchronized Pipe with a variable length internal buffer. It contains an Activity and when the consumer reads data from the pipe, this activity is processed incrementally to generate the data that will be returned. In other words, reading data from the pipe effectively drives the processing of the activity.
| Field Summary | |
private static java.lang.String |
COPYRIGHT_NOTICECopyright statement. |
private Activity |
mActivityThe activity that outputs data into this pipe when processed. |
private java.util.List |
mBufferStores the blocks of data put into the pipe by the activity. |
private boolean |
mClosedIndicates whether or not the pipe has been closed. |
| Constructor Summary | |
CallThroughPipe(Activity activity)Constructs a CallThroughPipe that will pull data from the specified source Activity. |
|
| Method Summary | |
void |
close()Closes the block writer to indicate that there are no more blocks are to be written. |
boolean |
hasNext()Indicates whether or not there are any more blocks of data to be read from the block reader. |
boolean |
isOpen()Indicates whether or not the block writer is open for writing via the put method. |
java.lang.Object |
next()Gets the next block of data contained in the block reader. |
private void |
process()Processes the handler until its activity has generated some output. |
void |
put(java.lang.Object block)Writes the specified block of output data. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
private static final java.lang.String COPYRIGHT_NOTICE
private final Activity mActivity
private final java.util.List mBuffer
private boolean mClosed
| Constructor Detail |
public CallThroughPipe(Activity activity)
CallThroughPipe that will pull data from the specified source Activity. When another activity attempts to read data from the pipe, the source activity is processed enough to generate the data.
activity - Source Activity| Method Detail |
public boolean hasNext()
BlockReaderhasNext in interface BlockReaderpublic java.lang.Object next()
BlockReadernext in interface BlockReaderObjectpublic void put(java.lang.Object block)
BlockWriterput in interface BlockWriterblock - the Object block to writeprivate void process()
mHasNext flag is set to false.
If a Throwable should inadvertently occur during the activity's process method, catch it, wrap it in an ActivityExecutionException and instruct the activity to save a reference using its setError method.
public void close()
BlockWriterput method should no longer be used.
close in interface BlockWriterpublic boolean isOpen()
BlockWriterput method. After the close method has been invoked this method should return false.
isOpen in interface BlockWriter
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||