Class ChannelPipedInputStream

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

    public class ChannelPipedInputStream
    extends java.io.InputStream
    implements ChannelPipedSink
    TODO Add javadoc
    • Field Detail

      • b

        private final byte[] b
      • open

        private final java.util.concurrent.atomic.AtomicBoolean open
      • lock

        private final java.util.concurrent.locks.Lock lock
      • dataAvailable

        private final java.util.concurrent.locks.Condition dataAvailable
      • writerClosed

        private final java.util.concurrent.atomic.AtomicBoolean writerClosed
        ChannelPipedOutputStream is already closed and so we will not receive additional data. This is different from the isOpen(), which indicates that the reader of this InputStream will not be reading data any more.
      • buffer

        private Buffer buffer
      • timeout

        private long timeout
    • Constructor Detail

      • ChannelPipedInputStream

        public ChannelPipedInputStream​(LocalWindow localWindow,
                                       java.time.Duration windowTimeout)
      • ChannelPipedInputStream

        public ChannelPipedInputStream​(LocalWindow localWindow,
                                       long windowTimeout)
    • Method Detail

      • isOpen

        public boolean isOpen()
        Specified by:
        isOpen in interface java.nio.channels.Channel
      • setTimeout

        public void setTimeout​(long timeout)
      • getTimeout

        public long getTimeout()
      • available

        public int available()
                      throws java.io.IOException
        Overrides:
        available in class java.io.InputStream
        Throws:
        java.io.IOException
      • read

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

        public int read​(byte[] b,
                        int off,
                        int len)
                 throws java.io.IOException
        Overrides:
        read in class java.io.InputStream
        Throws:
        java.io.IOException
      • close

        public void close()
                   throws java.io.IOException
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.nio.channels.Channel
        Specified by:
        close in interface java.io.Closeable
        Overrides:
        close in class java.io.InputStream
        Throws:
        java.io.IOException
      • receive

        public void receive​(byte[] bytes,
                            int off,
                            int len)
                     throws java.io.IOException
        Specified by:
        receive in interface ChannelPipedSink
        Parameters:
        bytes - Bytes to be sent to the sink
        off - Offset in buffer
        len - Number of bytes
        Throws:
        java.io.IOException - If failed to send the data