MCPcopy Index your code
hub / github.com/SeleniumHQ/selenium / consume

Method consume

java/src/org/openqa/selenium/net/UrlChecker.java:168–182  ·  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

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

Callers 2

waitUntilAvailableMethod · 0.95
waitUntilUnavailableMethod · 0.95

Calls 1

toByteArrayMethod · 0.95

Tested by

no test coverage detected