Class AbstractChannelReader

java.lang.Object
org.apache.nifi.io.nio.AbstractChannelReader
All Implemented Interfaces:
Runnable
Direct Known Subclasses:
DatagramChannelReader, SocketChannelReader

public abstract class AbstractChannelReader extends Object implements Runnable
  • Field Details

  • Constructor Details

  • Method Details

    • setScheduledFuture

      protected void setScheduledFuture(ScheduledFuture<?> future)
    • getScheduledFuture

      protected ScheduledFuture<?> getScheduledFuture()
    • getSelectionKey

      protected SelectionKey getSelectionKey()
    • isClosed

      public boolean isClosed()
    • closeStream

      private void closeStream()
    • fillBuffer

      protected abstract int fillBuffer(SelectionKey key, ByteBuffer buffer) throws IOException
      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 from
      buffer - 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()
      Specified by:
      run in interface Runnable
    • equals

      public final boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public final int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public final String toString()
      Overrides:
      toString in class Object