Package org.restlet.engine.io
Class NbChannelOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- org.restlet.engine.io.NbChannelOutputStream
-
- All Implemented Interfaces:
java.io.Closeable,java.io.Flushable,java.lang.AutoCloseable
public class NbChannelOutputStream extends java.io.OutputStreamOutput stream connected to a non-blocking writable channel.
-
-
Field Summary
Fields Modifier and Type Field Description private java.nio.ByteBufferbbThe internal byte buffer.private java.nio.channels.WritableByteChannelchannelThe channel to write to.private java.nio.channels.SelectableChannelselectableChannelThe selectable channel to write to.private java.nio.channels.SelectionKeyselectionKeyThe selection key.private java.nio.channels.SelectorselectorThe selector.
-
Constructor Summary
Constructors Constructor Description NbChannelOutputStream(java.nio.channels.WritableByteChannel channel)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voiddoWrite()Effectively write the current byte buffer.voidwrite(byte[] b, int off, int len)voidwrite(int b)
-
-
-
Field Detail
-
bb
private final java.nio.ByteBuffer bb
The internal byte buffer.
-
channel
private final java.nio.channels.WritableByteChannel channel
The channel to write to.
-
selectableChannel
private final java.nio.channels.SelectableChannel selectableChannel
The selectable channel to write to.
-
selectionKey
private volatile java.nio.channels.SelectionKey selectionKey
The selection key.
-
selector
private volatile java.nio.channels.Selector selector
The selector.
-
-
Method Detail
-
doWrite
private void doWrite() throws java.io.IOExceptionEffectively write the current byte buffer.- Throws:
java.io.IOException
-
write
public void write(byte[] b, int off, int len) throws java.io.IOException- Overrides:
writein classjava.io.OutputStream- Throws:
java.io.IOException
-
write
public void write(int b) throws java.io.IOException- Specified by:
writein classjava.io.OutputStream- Throws:
java.io.IOException
-
-