Interface IStream

  • All Superinterfaces:
    Attachable, java.lang.AutoCloseable, java.io.Closeable, Stream
    All Known Implementing Classes:
    HTTP2Stream

    public interface IStream
    extends Stream, Attachable, java.io.Closeable

    The SPI interface for implementing an HTTP/2 stream.

    This class extends Stream by adding the methods required to implement the HTTP/2 stream functionalities.

    • Method Detail

      • isLocal

        boolean isLocal()
        Returns:
        whether this stream is local or remote
      • getSession

        ISession getSession()
        Specified by:
        getSession in interface Stream
        Returns:
        the session this stream is associated to
      • send

        void send​(IStream.FrameList frameList,
                  Callback callback)

        Sends the given list of frames.

        Typically used to send HTTP headers along with content and possibly trailers.

        Parameters:
        frameList - the list of frames to send
        callback - the callback that gets notified when the frames have been sent
      • process

        void process​(Frame frame,
                     Callback callback)

        Processes the given frame, belonging to this stream.

        Parameters:
        frame - the frame to process
        callback - the callback to complete when frame has been processed
      • updateClose

        boolean updateClose​(boolean update,
                            CloseState.Event event)

        Updates the close state of this stream.

        Parameters:
        update - whether to update the close state
        event - the event that caused the close state update
        Returns:
        whether the stream has been fully closed by this invocation
      • close

        void close()

        Forcibly closes this stream.

        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
      • updateSendWindow

        int updateSendWindow​(int delta)

        Updates the stream send window by the given delta.

        Parameters:
        delta - the delta value (positive or negative) to add to the stream send window
        Returns:
        the previous value of the stream send window
      • updateRecvWindow

        int updateRecvWindow​(int delta)

        Updates the stream receive window by the given delta.

        Parameters:
        delta - the delta value (positive or negative) to add to the stream receive window
        Returns:
        the previous value of the stream receive window
      • notIdle

        void notIdle()

        Marks this stream as not idle so that the idle timeout is postponed.

      • isRemotelyClosed

        boolean isRemotelyClosed()
        Returns:
        whether the stream is closed remotely.
        See Also:
        Stream.isClosed()
      • commit

        void commit()
        Marks this stream as committed.
        See Also:
        isCommitted()
      • isCommitted

        boolean isCommitted()
        Returns:
        whether bytes for this stream have been sent to the remote peer.
        See Also:
        commit()