public static HttpURLConnection putFile ( final URI uri , final FileRequestOptions fileOptions , final OperationContext opContext , final AccessCondition accessCondition , final FileProperties properties , final long fileSize ) throws IOException , URISyntaxException , StorageException { final HttpURLConnection request = BaseRequest . createURLConnection ( uri , fileOptions , null , opContext ) ; request . setDoOutput ( true ) ; request . setRequestMethod ( Constants . HTTP_PUT ) ; addProperties ( request , properties ) ; request . setFixedLengthStreamingMode ( 0 ) ; request . setRequestProperty ( Constants . HeaderConstants . CONTENT_LENGTH , "0" ) ; request . setRequestProperty ( FileConstants . FILE_TYPE_HEADER , FileConstants . FILE ) ; request . setRequestProperty ( FileConstants . CONTENT_LENGTH_HEADER , String . valueOf ( fileSize ) ) ; properties . setLength ( fileSize ) ; if ( accessCondition != null ) { accessCondition . applyConditionToRequest ( request ) ; } return request ; }
Constructs a HttpURLConnection to upload a file .