List of usage examples for io.netty.channel ChannelOutboundBuffer nioBuffers
public ByteBuffer[] nioBuffers()
From source file:io.nodyn.netty.pipe.NioOutputStreamChannel.java
License:Apache License
@Override protected void doWrite(final ChannelOutboundBuffer in) throws Exception { this.process.getEventLoop().submitBlockingTask(new Runnable() { public void run() { ByteBuffer[] buffers = in.nioBuffers(); for (int i = 0; i < buffers.length; ++i) { ByteBuffer each = buffers[i]; int amount = each.limit() - each.position(); byte[] bytes = new byte[amount]; each.get(bytes);//from w w w. j a v a 2s.c o m try { NioOutputStreamChannel.this.out.write(bytes); } catch (IOException e) { NioOutputStreamChannel.this.process.getNodyn().handleThrowable(e); } } } }); }