List of usage examples for io.netty.channel EventLoopGroup register
ChannelFuture register(ChannelPromise promise);
From source file:io.nodyn.tty.ReadStream.java
License:Apache License
public static ChannelFuture create(NodeProcess process, int fd, StreamWrap handle) throws IOException { if (fd == 0) { InputStream in = System.in; EventLoopGroup eventLoopGroup = process.getEventLoop().getEventLoopGroup(); Channel channel = NioInputStreamChannel.create(process, in); channel.config().setAutoRead(false); channel.pipeline().addLast(new DataEventHandler(process, handle)); eventLoopGroup.register(channel); return channel.newSucceededFuture(); }/*from w w w.j a v a 2s . c o m*/ return null; }
From source file:io.nodyn.tty.WriteStream.java
License:Apache License
public static ChannelFuture create(NodeProcess process, int fd, StreamWrap handle) throws IOException { OutputStream out = null;//from w ww . j a v a2 s .c om if (fd == 1) { out = System.out; } else if (fd == 2) { out = System.err; } else { return null; } EventLoopGroup eventLoopGroup = process.getEventLoop().getEventLoopGroup(); Channel channel = NioOutputStreamChannel.create(process, out); channel.config().setAutoRead(false); channel.pipeline().addLast(new DataEventHandler(process, handle)); eventLoopGroup.register(channel); return channel.newSucceededFuture(); }