Interface BHttpConnection

All Superinterfaces:
AutoCloseable, Closeable, HttpConnection, ModalCloseable, SocketModalCloseable
All Known Subinterfaces:
HttpClientConnection, HttpServerConnection
All Known Implementing Classes:
BHttpConnectionBase, DefaultBHttpClientConnection, DefaultBHttpServerConnection, LoggingBHttpClientConnection, LoggingBHttpServerConnection

public interface BHttpConnection extends HttpConnection
Abstract blocking HTTP connection interface.
Since:
5.0
  • Method Details

    • isDataAvailable

      boolean isDataAvailable(Timeout timeout) throws IOException
      Checks if input data is available from the connection. May wait for the specified time until some data becomes available. Note that some implementations may completely ignore the timeout parameter.
      Parameters:
      timeout - the maximum time to wait for data
      Returns:
      true if data is available; false if there was no data available even after waiting for timeout.
      Throws:
      IOException - if an error happens on the connection
    • isStale

      boolean isStale() throws IOException
      Checks whether this connection has gone down. Network connections may get closed during some time of inactivity for several reasons. The next time a read is attempted on such a connection it will throw an IOException. This method tries to alleviate this inconvenience by trying to find out if a connection is still usable. Implementations may do that by attempting a read with a very small timeout. Thus this method may block for a small amount of time before returning a result. It is therefore an expensive operation.
      Returns:
      true if attempts to use this connection are likely to fail and this connection should be closed, or false if they are likely to succeed
      Throws:
      IOException
    • flush

      void flush() throws IOException
      Writes out all pending buffered data over the open connection.
      Throws:
      IOException - in case of an I/O error