io/src/main/java/com/stanfy/enroscar/io/IoUtils.java
public static void consumeStream(final InputStream input, final BuffersPool buffersPool) throws IOException {
    // do not use skip, just use a buffer and read it all
    final byte[] buffer = buffersPool == null
        ? new byte[BUFFER_SIZE_8K]
        : buffersPool.get(BUFFER_SIZE_8K);

    try {
      //noinspection StatementWithEmptyBody
      while (input.read(buffer) != EOF);
    } finally {
      closeQuietly(input);

      if (buffersPool != null) {
        buffersPool.release(buffer);
      }
    }

  }
public static void consumeStream(final InputStream input, final BuffersPool buffersPool) throws IOException {
    // do not use skip, just use a buffer and read it all
    final byte[] buffer = buffersPool == null
        ? new byte[BUFFER_SIZE_8K]
        : buffersPool.get(BUFFER_SIZE_8K);

    try {
      //noinspection StatementWithEmptyBody
      while (input.read(buffer) != EOF);
    } finally {
      closeQuietly(input);

      if (buffersPool != null) {
        buffersPool.release(buffer);
      }
    }

  }
public static void consumeStream ( final InputStream input , final BuffersPool buffersPool ) throws IOException { // do not use skip, just use a buffer and read it all final byte [ ] buffer = buffersPool == null ? new byte [ BUFFER_SIZE_8K ] : buffersPool . get ( BUFFER_SIZE_8K ) ; try { //noinspection StatementWithEmptyBody while ( input . read ( buffer ) != EOF ) ; } finally { closeQuietly ( input ) ; if ( buffersPool != null ) { buffersPool . release ( buffer ) ; } } }
Consume the stream and close it.
This implementation calls {@link InputStream#read(byte[])} method and ignores any read bytes.

@param input input stream
@throws IOException if I/O error happens
Consume the stream and close it . This implementation calls { @link InputStream#read ( byte [] ) } method and ignores any read bytes .