public long getContentLength() throws NumberFormatException {
    String contentLengthHeader =
        httpResponse.getHeaders().getFirstHeaderStringValue(HttpHeaders.CONTENT_LENGTH);
    if (contentLengthHeader == null) {
      return -1;
    }
    try {
      return Long.parseLong(contentLengthHeader);

    } catch (NumberFormatException ex) {
      return -1;
    }
  }
Returns the content length from the header.

@return the first {@code Content-Length} header, or {@code -1} if not found
@throws NumberFormatException if parsing the content length header fails
jib-core/src/main/java/com/google/cloud/tools/jib/http/Response.java