private int checkReadSoFarOrThrow(int read) throws IOException {
    if (read >= 0) {
      readSoFar += read;
    } else if (contentLength - readSoFar > 0) {
      throw new IOException("Failed to read all expected data"
          + ", expected: " + contentLength
          + ", but read: " + readSoFar);
    }
    return read;
  }
Uses the content length as the basis for the return value of {@link #available()} and verifies
that at least content length bytes are returned from the various read methods.
core/src/main/java/com/bumptech/glide/util/ContentLengthInputStream.java