Class QuicStreamEndPoint

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

    public class QuicStreamEndPoint
    extends AbstractEndPoint

    An EndPoint implementation on top of a QUIC stream.

    The correspondent Connection associated to this QuicStreamEndPoint parses and generates the protocol specific bytes transported by QUIC.

    • Constructor Detail

      • QuicStreamEndPoint

        public QuicStreamEndPoint​(Scheduler scheduler,
                                  QuicSession session,
                                  long streamId)
    • Method Detail

      • opened

        public void opened()
      • closed

        public void closed​(java.lang.Throwable failure)
      • getStreamId

        public long getStreamId()
      • isStreamFinished

        public boolean isStreamFinished()
      • shutdownInput

        public void shutdownInput​(long error)
      • shutdownOutput

        public void shutdownOutput​(long error)
      • close

        public void close​(long error,
                          java.lang.Throwable failure)
      • onClose

        public void onClose​(java.lang.Throwable failure)
        Description copied from interface: EndPoint

        Callback method invoked when this EndPoint is closed.

        Specified by:
        onClose in interface EndPoint
        Overrides:
        onClose in class AbstractEndPoint
        Parameters:
        failure - The reason for the close, or null if a normal close.
        See Also:
        EndPoint.onOpen()
      • fill

        public int fill​(java.nio.ByteBuffer buffer)
                 throws java.io.IOException
        Description copied from interface: EndPoint
        Fill the passed buffer with data from this endpoint. The bytes are appended to any data already in the buffer by writing from the buffers limit up to it's capacity. The limit is updated to include the filled bytes.
        Parameters:
        buffer - The buffer to fill. The position and limit are modified during the fill. After the operation, the position is unchanged and the limit is increased to reflect the new data filled.
        Returns:
        an int value indicating the number of bytes filled or -1 if EOF is read or the input is shutdown.
        Throws:
        java.io.IOException - if the endpoint is closed.
      • flush

        public boolean flush​(java.nio.ByteBuffer... buffers)
                      throws java.io.IOException
        Description copied from interface: EndPoint
        Flush data from the passed header/buffer to this endpoint. As many bytes as can be consumed are taken from the header/buffer position up until the buffer limit. The header/buffers position is updated to indicate how many bytes have been consumed.
        Parameters:
        buffers - the buffers to flush
        Returns:
        True IFF all the buffers have been consumed and the endpoint has flushed the data to its destination (ie is not buffering any data).
        Throws:
        java.io.IOException - If the endpoint is closed or output is shutdown.
      • write

        public void write​(Callback callback,
                          java.util.List<java.nio.ByteBuffer> buffers,
                          boolean last)
      • getTransport

        public java.lang.Object getTransport()
        Returns:
        The underlying transport object (socket, channel, etc.)
      • onWritable

        public void onWritable()
      • onReadable

        public boolean onReadable()
        Returns:
        whether this endPoint is interested in reads
      • fillInterested

        public void fillInterested​(Callback callback)
        Description copied from interface: EndPoint

        Requests callback methods to be invoked when a call to EndPoint.fill(ByteBuffer) would return data or EOF.

        Specified by:
        fillInterested in interface EndPoint
        Overrides:
        fillInterested in class AbstractEndPoint
        Parameters:
        callback - the callback to call when an error occurs or we are readable. The callback may implement the Invocable interface to self declare its blocking status. Non-blocking callbacks may be called more efficiently without dispatch delays.
      • tryFillInterested

        public boolean tryFillInterested​(Callback callback)
        Description copied from interface: EndPoint

        Requests callback methods to be invoked when a call to EndPoint.fill(ByteBuffer) would return data or EOF.

        Specified by:
        tryFillInterested in interface EndPoint
        Overrides:
        tryFillInterested in class AbstractEndPoint
        Parameters:
        callback - the callback to call when an error occurs or we are readable. The callback may implement the Invocable interface to self declare its blocking status. Non-blocking callbacks may be called more efficiently without dispatch delays.
        Returns:
        true if set