Class QuicStreamEndPoint

All Implemented Interfaces:
Closeable, 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 Details

    • QuicStreamEndPoint

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

    • opened

      public void opened()
    • closed

      public void closed(Throwable failure)
    • getQuicSession

      public QuicSession getQuicSession()
    • getStreamId

      public long getStreamId()
    • getLocalSocketAddress

      public SocketAddress getLocalSocketAddress()
      Specified by:
      getLocalSocketAddress in interface EndPoint
      Overrides:
      getLocalSocketAddress in class AbstractEndPoint
      Returns:
      the local SocketAddress to which this EndPoint is bound or null if this EndPoint is not bound to a Socket address.
    • getRemoteSocketAddress

      public SocketAddress getRemoteSocketAddress()
      Specified by:
      getRemoteSocketAddress in interface EndPoint
      Overrides:
      getRemoteSocketAddress in class AbstractEndPoint
      Returns:
      The remote SocketAddress to which this EndPoint is connected, or null if this EndPoint is not connected to a Socket address.
    • isStreamFinished

      public boolean isStreamFinished()
    • shutdownInput

      public void shutdownInput(long error)
    • shutdownOutput

      public void shutdownOutput(long error)
    • close

      public void close(long error, Throwable failure)
    • onClose

      public void onClose(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:
    • fill

      public int fill(ByteBuffer buffer) throws 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:
      IOException - if the endpoint is closed.
    • flush

      public boolean flush(ByteBuffer... buffers) throws 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:
      IOException - If the endpoint is closed or output is shutdown.
    • write

      public void write(Callback callback, List<ByteBuffer> buffers, boolean last)
    • getTransport

      public 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
    • onIncompleteFlush

      protected void onIncompleteFlush()
      Specified by:
      onIncompleteFlush in class AbstractEndPoint
    • needsFillInterest

      protected void needsFillInterest()
      Specified by:
      needsFillInterest in class AbstractEndPoint
    • toString

      public String toString()
      Overrides:
      toString in class AbstractEndPoint