Class FramedStream


  • public final class FramedStream
    extends Object
    A logical bidirectional stream.
    • Method Detail

      • getId

        public int getId()
      • isOpen

        public boolean isOpen()
        Returns true if this stream is open. A stream is open until either:
        • A SYN_RESET frame abnormally terminates the stream.
        • Both input and output streams have transmitted all data and headers.
        Note that the input stream may continue to yield data even after a stream reports itself as not open. This is because input data is buffered.
      • isLocallyInitiated

        public boolean isLocallyInitiated()
        Returns true if this stream was created by this peer.
      • getRequestHeaders

        public List<Header> getRequestHeaders()
      • getResponseHeaders

        public List<Header> getResponseHeaders()
                                        throws IOException
        Returns the stream's response headers, blocking if necessary if they have not been received yet.
        Throws:
        IOException
      • getErrorCode

        public ErrorCode getErrorCode()
        Returns the reason why this stream was closed, or null if it closed normally or has not yet been closed.
      • reply

        public void reply​(List<Header> responseHeaders,
                          boolean out)
                   throws IOException
        Sends a reply to an incoming stream.
        Parameters:
        out - true to create an output stream that we can use to send data to the remote peer. Corresponds to FLAG_FIN.
        Throws:
        IOException
      • readTimeout

        public Timeout readTimeout()
      • writeTimeout

        public Timeout writeTimeout()
      • getSource

        public Source getSource()
        Returns a source that reads data from the peer.
      • close

        public void close​(ErrorCode rstStatusCode)
                   throws IOException
        Abnormally terminate this stream. This blocks until the RST_STREAM frame has been transmitted.
        Throws:
        IOException
      • closeLater

        public void closeLater​(ErrorCode errorCode)
        Abnormally terminate this stream. This enqueues a RST_STREAM frame and returns immediately.