Class ReadableSizedChannel

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable, java.nio.channels.Channel, java.nio.channels.ReadableByteChannel

    @Deprecated
    public class ReadableSizedChannel
    extends WrapperChannel<java.nio.channels.ReadableByteChannel>
    implements java.nio.channels.ReadableByteChannel
    Deprecated.
    Will be removed to favor lower-level network extensions allowing more control at the Restlet API level.
    Readable byte channel enforcing a maximum size.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private long availableSize
      Deprecated.
      The total available size that should be read from the source channel.
      private boolean endDetected
      Deprecated.
      Indicates if the end of the wrapped channel has been reached.
    • Constructor Summary

      Constructors 
      Constructor Description
      ReadableSizedChannel​(java.nio.channels.ReadableByteChannel source, long availableSize)
      Deprecated.
      Constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      protected long getAvailableSize()
      Deprecated.
      Returns the remaining size that should be read from the source channel.
      protected boolean isEndDetected()
      Deprecated.
      Indicates if the end of the channel has been detected.
      int read​(java.nio.ByteBuffer dst)
      Deprecated.
      Reads some bytes and put them into the destination buffer.
      protected void setAvailableSize​(long availableSize)
      Deprecated.
      Sets the remaining size that should be read from the source channel.
      protected void setEndDetected​(boolean endDetected)
      Deprecated.
      Indicates if the end of the channel has been detected.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.nio.channels.Channel

        close, isOpen
    • Field Detail

      • availableSize

        private volatile long availableSize
        Deprecated.
        The total available size that should be read from the source channel.
      • endDetected

        private volatile boolean endDetected
        Deprecated.
        Indicates if the end of the wrapped channel has been reached.
    • Constructor Detail

      • ReadableSizedChannel

        public ReadableSizedChannel​(java.nio.channels.ReadableByteChannel source,
                                    long availableSize)
        Deprecated.
        Constructor.
        Parameters:
        source - The source channel.
        availableSize - The total available size that can be read from the source channel.
    • Method Detail

      • getAvailableSize

        protected long getAvailableSize()
        Deprecated.
        Returns the remaining size that should be read from the source channel.
        Returns:
        The remaining size that should be read from the source channel.
      • isEndDetected

        protected boolean isEndDetected()
        Deprecated.
        Indicates if the end of the channel has been detected.
        Returns:
        True if the end of the channel has been detected.
      • read

        public int read​(java.nio.ByteBuffer dst)
                 throws java.io.IOException
        Deprecated.
        Reads some bytes and put them into the destination buffer. The bytes come from the underlying channel.
        Specified by:
        read in interface java.nio.channels.ReadableByteChannel
        Parameters:
        dst - The destination buffer.
        Returns:
        The number of bytes read, or -1 if the end of the channel has been reached.
        Throws:
        java.io.IOException
      • setAvailableSize

        protected void setAvailableSize​(long availableSize)
        Deprecated.
        Sets the remaining size that should be read from the source channel.
        Parameters:
        availableSize - The remaining size that should be read from the source channel.
      • setEndDetected

        protected void setEndDetected​(boolean endDetected)
                               throws java.io.IOException
        Deprecated.
        Indicates if the end of the channel has been detected.
        Parameters:
        endDetected - True if the end of the channel has been detected.
        Throws:
        java.io.IOException