Top Description Methods
org.apache.hc.core5.http.io

public Interface BHttpConnection

extends HttpConnection
Known Direct Subinterfaces
org.apache.hc.core5.http.io.HttpClientConnection, org.apache.hc.core5.http.io.HttpServerConnection
Known Direct Implementers
org.apache.hc.core5.http.impl.io.BHttpConnectionBase
Imports
java.io.IOException, org.apache.hc.core5.http.HttpConnection, org.apache.hc.core5.util.Timeout

Abstract blocking HTTP connection interface.
Since
5.0

Method Summary

Modifier and TypeMethod and Description
public void
flush()

Writes out all pending buffered data over the open connection.

public boolean

Returns:

true if data is available; false if there was no data available even after waiting for timeout.
isDataAvailable
(Timeout
the maximum time to wait for data
timeout
)

Checks if input data is available from the connection.

public boolean

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
isStale
()

Checks whether this connection has gone down.

Inherited from org.apache.hc.core5.http.HttpConnection:
closegetEndpointDetailsgetLocalAddressgetProtocolVersiongetRemoteAddressgetSSLSessionisOpen

Method Detail

flushback to summary
public void flush() throws IOException

Writes out all pending buffered data over the open connection.

Exceptions
IOException:
in case of an I/O error
isDataAvailableback to summary
public 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:Timeout

the maximum time to wait for data

Returns:boolean

true if data is available; false if there was no data available even after waiting for timeout.

Exceptions
IOException:
if an error happens on the connection
isStaleback to summary
public 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:boolean

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