public static long getContentLength(PutObjectRequest putObjectRequest) {
        File file = getRequestFile(putObjectRequest);
        if (file != null) return file.length();

        if (putObjectRequest.getInputStream() != null) {
            if (putObjectRequest.getMetadata().getContentLength() > 0) {
                return putObjectRequest.getMetadata().getContentLength();
            }
        }

        return -1;
    }
public static long getContentLength ( PutObjectRequest putObjectRequest ) { File file = getRequestFile ( putObjectRequest ) ; if ( file != null ) return file . length ( ) ; if ( putObjectRequest . getInputStream ( ) != null ) { if ( putObjectRequest . getMetadata ( ) . getContentLength ( ) > 0 ) { return putObjectRequest . getMetadata ( ) . getContentLength ( ) ; } } return - 1 ; }
Returns the size of the data in this request, otherwise -1 if the content
length is unknown.

@param putObjectRequest
The request to check.

@return The size of the data in this request, otherwise -1 if the size of
the data is unknown.