public static Long getContentLengthFromContentRange ( ObjectMetadata metadata ) { ValidationUtils . assertNotNull ( metadata , "Object metadata" ) ; String contentRange = ( String ) metadata . getRawMetadataValue ( Headers . CONTENT_RANGE ) ; if ( contentRange != null ) { try { String [ ] tokens = contentRange . split ( "[ -/]+" ) ; return Long . parseLong ( tokens [ 3 ] ) ; } catch ( Exception e ) { log . info ( String . format ( "Error parsing 'Content-Range' header value: %s. So returning " + "null value for content length" , contentRange ) , e ) ; } } return null ; }
Returns the content length of the object if response contains the Content - Range header and is well formed .