public static HttpURLConnection getFile ( final URI uri , final FileRequestOptions fileOptions , final OperationContext opContext , final AccessCondition accessCondition , final String snapshotVersion , final Long offset , final Long count , boolean requestRangeContentMD5 ) throws IOException , URISyntaxException , StorageException { if ( offset != null && requestRangeContentMD5 ) { Utility . assertNotNull ( "count" , count ) ; Utility . assertInBounds ( "count" , count , 1 , Constants . MAX_BLOCK_SIZE ) ; } final UriQueryBuilder builder = new UriQueryBuilder ( ) ; FileRequest . addShareSnapshot ( builder , snapshotVersion ) ; final HttpURLConnection request = BaseRequest . createURLConnection ( uri , fileOptions , builder , opContext ) ; request . setRequestMethod ( Constants . HTTP_GET ) ; if ( accessCondition != null ) { accessCondition . applyConditionToRequest ( request ) ; } if ( offset != null ) { long rangeStart = offset ; long rangeEnd ; if ( count != null ) { rangeEnd = offset + count - 1 ; request . setRequestProperty ( Constants . HeaderConstants . STORAGE_RANGE_HEADER , String . format ( Utility . LOCALE_US , Constants . HeaderConstants . RANGE_HEADER_FORMAT , rangeStart , rangeEnd ) ) ; } else { request . setRequestProperty ( Constants . HeaderConstants . STORAGE_RANGE_HEADER , String . format ( Utility . LOCALE_US , Constants . HeaderConstants . BEGIN_RANGE_HEADER_FORMAT , rangeStart ) ) ; } } if ( offset != null && requestRangeContentMD5 ) { request . setRequestProperty ( Constants . HeaderConstants . RANGE_GET_CONTENT_MD5 , Constants . TRUE ) ; } return request ; }
Constructs a HttpURLConnection to download the file Sign with no length specified .