code: public static void consumeStream(InputStream is) {
          if (is != null) {
              try {
                  // Copy the stream to a null destination
                  long copied = IOUtils.copyLarge(is, NullOutputStream.NULL_OUTPUT_STREAM);
                  if (copied > 0) {
                      logger.log(Level.WARNING, "Consumed unused HTTP response error stream.");
                  }
              } catch (IOException ioe) {
                  // The stream was probably already closed, there's nothing further we can do anyway
                  logger.log(Level.FINEST, "Unable to consume stream.", ioe);
              }
          }
      }
docs: Consumes any available content from the stream (effectively sending it to /dev/null).
  
  @param is the stream to consume, may be {@code null}