/** * Convenience method for {@link #rename(TachyonFile, TachyonURI, RenameOptions)} with default * options. */ public boolean rename(TachyonFile src, TachyonURI dst) throws IOException, TachyonException, FileDoesNotExistException { return rename(src, dst, RenameOptions.defaults()); }
/** * Renames a file or directory specified by argv. Will fail if the new path name already exists. * * @param argv [] Array of arguments given by the user's input from the terminal * @return 0 if command is successful, -1 if an error occurred * @throws IOException */ public int rename(String[] argv) throws IOException { TachyonURI srcPath = new TachyonURI(argv[1]); TachyonURI dstPath = new TachyonURI(argv[2]); try { TachyonFile fd = mTfs.open(srcPath); if (mTfs.rename(fd, dstPath)) { System.out.println("Renamed " + srcPath + " to " + dstPath); return 0; } else { System.out.println("mv: Failed to rename " + srcPath + " to " + dstPath); return -1; } } catch (TachyonException e) { throw new IOException(e.getMessage()); } }
throw e; sTfs.rename(sTfs.open(testURI), new TachyonURI(testURI + "-rename")); } else if (ClientOpType.CREATE_TABLE == mOpType) { if (sOldTfs.createRawTable(new TachyonURI(mWorkDir + mSuccessNum), 1) == -1) {