MCPcopy Create free account
hub / github.com/SeleniumHQ/selenium / consume

Method consume

java/src/org/openqa/selenium/net/UrlChecker.java:163–177  ·  view source on GitHub ↗

Read and closes the ErrorStream / InputStream of the HttpURLConnection to allow Java reusing the open socket. @param connection the connection to consume the input

(HttpURLConnection connection)

Source from the content-addressed store, hash-verified

161 * @param connection the connection to consume the input
162 */
163 private static void consume(HttpURLConnection connection) {
164 try (InputStream errorStream = connection.getErrorStream()) {
165 if (errorStream != null) {
166 Read.toByteArray(errorStream);
167 } else {
168 try (InputStream inputStream = connection.getInputStream()) {
169 if (inputStream != null) {
170 Read.toByteArray(inputStream);
171 }
172 }
173 }
174 } catch (IOException ignore) {
175 // swallow
176 }
177 }
178
179 private HttpURLConnection connectToUrl(URL url) throws IOException {
180 HttpURLConnection connection = (HttpURLConnection) url.openConnection();

Callers 2

waitUntilAvailableMethod · 0.95
waitUntilUnavailableMethod · 0.95

Calls 1

toByteArrayMethod · 0.95

Tested by

no test coverage detected