@ DoesServiceRequest public void upload ( final InputStream sourceStream , final long length , final AccessCondition accessCondition , FileRequestOptions options , OperationContext opContext ) throws StorageException , IOException , URISyntaxException { if ( opContext == null ) { opContext = new OperationContext ( ) ; } this . getShare ( ) . assertNoSnapshot ( ) ; options = FileRequestOptions . populateAndApplyDefaults ( options , this . fileServiceClient ) ; if ( length < 0 ) { throw new IllegalArgumentException ( SR . INVALID_FILE_LENGTH ) ; } if ( sourceStream . markSupported ( ) ) { // Mark sourceStream for current position. sourceStream . mark ( Constants . MAX_MARK_LENGTH ) ; } final FileOutputStream streamRef = this . openWriteNew ( length , accessCondition , options , opContext ) ; try { streamRef . write ( sourceStream , length ) ; } finally { streamRef . close ( ) ; } }
Uploads the source stream data to the file using the specified access condition request options and operation context . If the file already exists on the service it will be overwritten .