public boolean rename()

in src/main/java/com/microsoft/azure/datalake/store/ADLStoreClient.java [745:764]


    public boolean rename(String path, String newName, boolean overwrite) throws IOException {
        if (path==null || path.equals("")) throw new IllegalArgumentException("Path cannot be null or empty");
        if (path.equals("/")) throw new IllegalArgumentException("Cannot rename root directory");

        // In case of self rename operation, HDFS semantics expects true if file, false if directory.
        // Renaming self is not a common operation. but more obvious to contract test validation.
        if(path.equals(newName)) {
            return getDirectoryEntry(path).type == DirectoryEntryType.FILE;
        }

        RequestOptions opts = new RequestOptions();
        opts.retryPolicy = makeExponentialBackoffPolicy();
        opts.timeout = this.timeout;
        OperationResponse resp = new OperationResponse();
        boolean succeeded = Core.rename(path, newName, overwrite, this, opts, resp);
        if (!resp.successful) {
            throw getExceptionFromResponse(resp, "Error renaming file " + path);
        }
        return succeeded;
    }