コード例 #1
0
  /**
   * Exhaust the content of the representation by reading it and silently discarding anything read.
   * By default, it relies on {@link #getStream()} and closes the retrieved stream in the end.
   *
   * @return The number of bytes consumed or -1 if unknown.
   */
  public long exhaust() throws IOException {
    long result = -1L;

    if (isAvailable()) {
      InputStream is = getStream();
      result = IoUtils.exhaust(is);
      is.close();
    }

    return result;
  }