Package org.apache.nifi.io.nio
Class AbstractChannelReader
java.lang.Object
org.apache.nifi.io.nio.AbstractChannelReader
- All Implemented Interfaces:
Runnable
- Direct Known Subclasses:
DatagramChannelReader
,SocketChannelReader
-
Field Summary
Modifier and TypeFieldDescriptionprivate final BufferPool
private final StreamConsumer
private final AtomicReference
<ScheduledFuture<?>> private final AtomicBoolean
private final SelectionKey
private static final org.slf4j.Logger
private final String
-
Constructor Summary
ConstructorDescriptionAbstractChannelReader
(String id, SelectionKey key, BufferPool empties, StreamConsumerFactory consumerFactory) -
Method Summary
Modifier and TypeMethodDescriptionprivate void
final boolean
protected abstract int
fillBuffer
(SelectionKey key, ByteBuffer buffer) Allows a subclass to specifically handle how it reads from the given key's channel into the given buffer.protected ScheduledFuture
<?> protected SelectionKey
final int
hashCode()
boolean
isClosed()
final void
run()
protected void
setScheduledFuture
(ScheduledFuture<?> future) final String
toString()
-
Field Details
-
LOGGER
private static final org.slf4j.Logger LOGGER -
uniqueId
-
key
-
bufferPool
-
consumer
-
isClosed
-
future
-
-
Constructor Details
-
AbstractChannelReader
public AbstractChannelReader(String id, SelectionKey key, BufferPool empties, StreamConsumerFactory consumerFactory)
-
-
Method Details
-
setScheduledFuture
-
getScheduledFuture
-
getSelectionKey
-
isClosed
public boolean isClosed() -
closeStream
private void closeStream() -
fillBuffer
Allows a subclass to specifically handle how it reads from the given key's channel into the given buffer.- Parameters:
key
- of channel to read frombuffer
- to fill- Returns:
- the number of bytes read in the final read cycle. A value of zero or more indicates the channel is still open but a value of -1 indicates end of stream.
- Throws:
IOException
- if reading from channel causes failure
-
run
public final void run() -
equals
-
hashCode
public final int hashCode() -
toString
-