FileDocCategorySizeDatePackage
SystemInPipe.javaAPI DocExample1928Mon Jan 27 10:06:08 GMT 2003com.ronsoft.books.nio.channels

SystemInPipe

public class SystemInPipe extends Object
Class which encapsulates System.in as a selectable channel. Instantiate this class, call start() on it to run the background draining thread, then call getStdinChannel() to get a SelectableChannel object which can be used with a Selector object.
author
Ron Hitchens (ron@ronsoft.com) created: Jan 2003

Fields Summary
Pipe
pipe
CopyThread
copyThread
Constructors Summary
public SystemInPipe(InputStream in)

		pipe = Pipe.open();

		copyThread = new CopyThread (in, pipe.sink());
	
public SystemInPipe()

		this (System.in);
	
Methods Summary
protected voidfinalize()

		copyThread.shutdown();
	
public java.nio.channels.SelectableChannelgetStdinChannel()

		SelectableChannel channel = pipe.source();

		channel.configureBlocking (false);

		return (channel);
	
public voidstart()

		copyThread.start();