Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 /* ************************************************************************
 #
 #  DivConq
 #
 #  http://divconq.com/
 #
 #  Copyright:
 #    Copyright 2014 eTimeline, LLC. All rights reserved.
 #
#  License:
#    See the license.txt file in the project's top-level directory for details.
#  Authors:
#    * Andy White
************************************************************************ */
package divconq.ctp.stream;
abstract public class BaseStream extends RecordStruct implements IStream {
	protected IStream upstream = null;
	protected IStream downstream = null;
	public void setUpstream(IStream upstream) {
		this. = upstream;
		upstream.setDownstream(this);
	}
	public void setDownstream(IStream downstream) {
		this. = downstream;
	}
	/*
	 * A message was sent from upstream to me.
	 * 
	 * @param msg data to process
	 * @return AWAIT if you are processing this async
	 */
	abstract public ReturnOption handle(FileDescriptor fileByteBuf data);

A cancel was sent from upstream to me.
	/*
	public void cancel(TaskRun cb) {
		if (this.downstream != null)
			this.downstream.cancel(cb);
	}
	*/

downstream is requesting that you send more messages
	abstract public void read();
	public IStreamSource getOrigin() {
		if (this instanceof IStreamSource)
			return (IStreamSourcethis;
		if (this. != null)
			return this..getOrigin();
		return null;
	}
	public void cleanup() {
		IStream up = this.;
		if (up != null)
			up.cleanup();
		this.close();
	}
	public void close() {
		this. = null;
		this. = null;
	}
New to GrepCode? Check out our FAQ X