code: protected void readBytes(final InputStream in, final ProgressByteProcessor processor) throws IOException {
          final byte[] buf = new byte[BUF_SIZE];
          try {
              int amt;
              do {
                  amt = in.read(buf);
                  if (amt == -1) {
                      break;
                  }
              } while (processor.processBytes(buf, 0, amt));
          } finally {
              IOUtils.closeQuietly(in);
          }
      }
docs: Inspired from Guava com.google.common.io.ByteStreams