private FileOutputStream openOutputStreamInternal ( Long length , AccessCondition accessCondition , FileRequestOptions options , OperationContext opContext ) throws StorageException , URISyntaxException { if ( opContext == null ) { opContext = new OperationContext ( ) ; } this . getShare ( ) . assertNoSnapshot ( ) ; options = FileRequestOptions . populateAndApplyDefaults ( options , this . fileServiceClient , false /* setStartTime */ ) ; if ( length != null ) { this . create ( length , accessCondition , options , opContext ) ; } else { if ( options . getStoreFileContentMD5 ( ) ) { throw new IllegalArgumentException ( SR . FILE_MD5_NOT_POSSIBLE ) ; } this . downloadAttributes ( accessCondition , options , opContext ) ; length = this . getProperties ( ) . getLength ( ) ; } if ( accessCondition != null ) { accessCondition = AccessCondition . generateLeaseCondition ( accessCondition . getLeaseID ( ) ) ; } return new FileOutputStream ( this , length , accessCondition , options , opContext ) ; }
Opens an output stream object to write data to the file using the specified lease ID request options and operation context . If the length is specified a new file will be created with the length specified . Otherwise the file must already exist and a stream of its current length will be opened .