in src/main/java/com/microsoft/azure/datalake/store/ADLStoreClient.java [277:301]
public ADLFileOutputStream createFile(String path, IfExists mode, String octalPermission, boolean createParent) throws IOException {
if (octalPermission != null && !octalPermission.equals("") && !Core.isValidOctal(octalPermission)) {
throw new IllegalArgumentException("Invalid directory permissions specified: " + octalPermission);
}
if (log.isTraceEnabled()) {
log.trace("create file for client {} for file {}", this.getClientId(), path);
}
String leaseId = UUID.randomUUID().toString();
if (this.enableConditionalCreate && mode == IfExists.OVERWRITE) {
CreateFileAtomicallyWithOverWrite(path, octalPermission, createParent, leaseId);
}
else {
boolean overwrite = (mode==IfExists.OVERWRITE);
RequestOptions opts = new RequestOptions();
opts.retryPolicy = overwrite ? makeExponentialBackoffPolicy() : new NonIdempotentRetryPolicy();
opts.timeout = this.timeout;
OperationResponse resp = new OperationResponse();
Core.create(path, overwrite, octalPermission, null, 0, 0, leaseId,
leaseId, createParent, SyncFlag.DATA, this, opts, resp);
if (!resp.successful) {
throw this.getExceptionFromResponse(resp, "Error creating file " + path);
}
}
return new ADLFileOutputStream(path, this, true, leaseId);
}