algoliasearch/src/main/java/com/algolia/search/saas/AbstractClient.java
private static void consumeQuietly(final HttpURLConnection connection) {
        try {
            int read = 0;
            while (read != -1) {
                read = connection.getInputStream().read();
            }
            connection.getInputStream().close();
            read = 0;
            while (read != -1) {
                read = connection.getErrorStream().read();
            }
            connection.getErrorStream().close();
            connection.disconnect();
        } catch (IOException e) {
            // no inputStream to close
        }
    }
private static void consumeQuietly(final HttpURLConnection connection) {
        try {
            int read = 0;
            while (read != -1) {
                read = connection.getInputStream().read();
            }
            connection.getInputStream().close();
            read = 0;
            while (read != -1) {
                read = connection.getErrorStream().read();
            }
            connection.getErrorStream().close();
            connection.disconnect();
        } catch (IOException e) {
            // no inputStream to close
        }
    }
private static void consumeQuietly ( final HttpURLConnection connection ) { try { int read = 0 ; while ( read != - 1 ) { read = connection . getInputStream ( ) . read ( ) ; } connection . getInputStream ( ) . close ( ) ; read = 0 ; while ( read != - 1 ) { read = connection . getErrorStream ( ) . read ( ) ; } connection . getErrorStream ( ) . close ( ) ; connection . disconnect ( ) ; } catch ( IOException e ) { // no inputStream to close } }
Ensures that the entity content is fully consumed and the content stream, if exists,
is closed.
Ensures that the entity content is fully consumed and the content stream if exists is closed .