private static int parseContentLength(String contentLengthHeader) {
    int result = UNKNOWN;
    if (!TextUtils.isEmpty(contentLengthHeader)) {
      try {
        result = Integer.parseInt(contentLengthHeader);
      } catch (NumberFormatException e) {
        if (Log.isLoggable(TAG, Log.DEBUG)) {
          Log.d(TAG, "failed to parse content length header: " + contentLengthHeader, e);
        }
      }
    }
    return result;
  }
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