List of usage examples for org.apache.commons.vfs2 FileObject canRenameTo
boolean canRenameTo(FileObject newfile);
From source file:org.apache.accumulo.start.classloader.vfs.providers.ReadOnlyHdfsFileProviderTest.java
@Test(expected = UnsupportedOperationException.class) public void testCanRenameTo() throws Exception { FileObject fo = createTestFile(this.hdfs); Assert.assertNotNull(fo);//from w w w . j a v a 2 s .c om fo.canRenameTo(fo); }
From source file:org.pentaho.vfs.ui.VfsBrowser.java
public boolean renameItem(TreeItem ti, String newName) throws FileSystemException { FileObject file = (FileObject) ti.getData(); FileObject newFileObject = file.getParent().resolveFile(newName); if (file.canRenameTo(newFileObject)) { if (!newFileObject.exists()) { newFileObject.createFile();// www. j a va 2 s. co m } else { return false; } file.moveTo(newFileObject); ti.setText(newName); ti.setData(newFileObject); return true; } else { return false; } }