Class ChannelInputStream

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable, BufferProcessor

    @Deprecated
    public class ChannelInputStream
    extends java.io.InputStream
    implements BufferProcessor
    Deprecated.
    Will be removed to favor lower-level network extensions allowing more control at the Restlet API level.
    Input stream connected to a non-blocking readable channel.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private Buffer buffer
      Deprecated.
      The internal byte buffer.
      private java.nio.channels.ReadableByteChannel channel
      Deprecated.
      The channel to read from.
      private boolean endReached
      Deprecated.
      Indicates if further reads can be attempted.
      private java.nio.channels.SelectableChannel selectableChannel
      Deprecated.
      The optional selectable channel to read from.
      private SelectionChannel selectionChannel
      Deprecated.
      The optional selection channel to read from.
      private SelectionRegistration selectionRegistration
      Deprecated.
      The registered selection registration.
    • Constructor Summary

      Constructors 
      Constructor Description
      ChannelInputStream​(java.nio.channels.ReadableByteChannel channel)
      Deprecated.
      Constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      boolean canLoop​(Buffer buffer, java.lang.Object... args)
      Deprecated.
      Indicates if the processing loop can continue.
      boolean couldFill​(Buffer buffer, java.lang.Object... args)
      Deprecated.
      Indicates if the buffer could be filled again.
      protected Buffer getBuffer()
      Deprecated.
      Returns the internal byte buffer.
      int onDrain​(Buffer buffer, int maxDrained, java.lang.Object... args)
      Deprecated.
      Drains the byte buffer by returning available bytes as InputStream bytes.
      int onFill​(Buffer buffer, java.lang.Object... args)
      Deprecated.
      Fills the byte buffer by reading the source channel.
      void onFillEof()
      Deprecated.
      Called back when a fill operation returns with an EOF status.
      void postProcess​(int drained)
      Deprecated.
      Does nothing by default.
      int preProcess​(int maxDrained, java.lang.Object... args)
      Deprecated.
      Does nothing by default.
      int read()
      Deprecated.
       
      int read​(byte[] targetArray, int offset, int length)
      Deprecated.
       
      • Methods inherited from class java.io.InputStream

        available, close, mark, markSupported, nullInputStream, read, readAllBytes, readNBytes, readNBytes, reset, skip, transferTo
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • buffer

        private final Buffer buffer
        Deprecated.
        The internal byte buffer.
      • channel

        private final java.nio.channels.ReadableByteChannel channel
        Deprecated.
        The channel to read from.
      • endReached

        private volatile boolean endReached
        Deprecated.
        Indicates if further reads can be attempted.
      • selectableChannel

        private final java.nio.channels.SelectableChannel selectableChannel
        Deprecated.
        The optional selectable channel to read from.
      • selectionChannel

        private final SelectionChannel selectionChannel
        Deprecated.
        The optional selection channel to read from.
      • selectionRegistration

        private volatile SelectionRegistration selectionRegistration
        Deprecated.
        The registered selection registration.
    • Constructor Detail

      • ChannelInputStream

        public ChannelInputStream​(java.nio.channels.ReadableByteChannel channel)
        Deprecated.
        Constructor.
        Parameters:
        channel - The channel to read from.
    • Method Detail

      • canLoop

        public boolean canLoop​(Buffer buffer,
                               java.lang.Object... args)
        Deprecated.
        Indicates if the processing loop can continue.
        Specified by:
        canLoop in interface BufferProcessor
        Parameters:
        buffer - The IO buffer to drain.
        args - The optional arguments to pass back to the callbacks.
        Returns:
        True if the processing loop can continue.
      • couldFill

        public boolean couldFill​(Buffer buffer,
                                 java.lang.Object... args)
        Deprecated.
        Indicates if the buffer could be filled again.
        Specified by:
        couldFill in interface BufferProcessor
        Parameters:
        buffer - The IO buffer to fill.
        args - The optional arguments to pass back to the callbacks.
        Returns:
        True if the buffer could be filled again.
      • getBuffer

        protected Buffer getBuffer()
        Deprecated.
        Returns the internal byte buffer.
        Returns:
        The internal byte buffer.
      • onDrain

        public int onDrain​(Buffer buffer,
                           int maxDrained,
                           java.lang.Object... args)
                    throws java.io.IOException
        Deprecated.
        Drains the byte buffer by returning available bytes as InputStream bytes.
        Specified by:
        onDrain in interface BufferProcessor
        Parameters:
        buffer - The IO buffer to drain.
        maxDrained - The maximum number of bytes drained by this call.
        args - The optional arguments to pass back to the callbacks.
        Returns:
        The number of bytes drained.
        Throws:
        java.io.IOException
      • onFill

        public int onFill​(Buffer buffer,
                          java.lang.Object... args)
                   throws java.io.IOException
        Deprecated.
        Fills the byte buffer by reading the source channel.
        Specified by:
        onFill in interface BufferProcessor
        Parameters:
        buffer - The IO buffer to drain.
        args - The optional arguments to pass back to the callbacks.
        Returns:
        The number of bytes filled.
        Throws:
        java.io.IOException
      • onFillEof

        public void onFillEof()
        Deprecated.
        Called back when a fill operation returns with an EOF status.
        Specified by:
        onFillEof in interface BufferProcessor
      • postProcess

        public void postProcess​(int drained)
                         throws java.io.IOException
        Deprecated.
        Does nothing by default.
        Specified by:
        postProcess in interface BufferProcessor
        Parameters:
        drained - The number of bytes drained or -1 if the filling source has ended.
        Throws:
        java.io.IOException
      • preProcess

        public int preProcess​(int maxDrained,
                              java.lang.Object... args)
                       throws java.io.IOException
        Deprecated.
        Does nothing by default.
        Specified by:
        preProcess in interface BufferProcessor
        Parameters:
        maxDrained - The maximum number of bytes drained by this call or 0 for unlimited length.
        args - The optional arguments to pass back to the callbacks.
        Returns:
        The number of bytes drained or -1 if the filling source has ended.
        Throws:
        java.io.IOException
      • read

        public int read()
                 throws java.io.IOException
        Deprecated.
        Specified by:
        read in class java.io.InputStream
        Throws:
        java.io.IOException
      • read

        public int read​(byte[] targetArray,
                        int offset,
                        int length)
                 throws java.io.IOException
        Deprecated.
        Overrides:
        read in class java.io.InputStream
        Throws:
        java.io.IOException