本文整理汇总了Java中org.apache.commons.vfs2.FileObject.getParent方法的典型用法代码示例。如果您正苦于以下问题:Java FileObject.getParent方法的具体用法?Java FileObject.getParent怎么用?Java FileObject.getParent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.vfs2.FileObject
的用法示例。
在下文中一共展示了FileObject.getParent方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: refreshFtpCache
import org.apache.commons.vfs2.FileObject; //导入方法依赖的package包/类
/**
* Refresh ftp cache.
*
* @param fileObject the file object
* @throws FileSystemException
*/
public void refreshFtpCache(FileObject fileObject) throws FileSystemException {
if (fileObject == null) {
return;
}
if (!(fileObject.getFileSystem() instanceof FtpFileSystem)) {
return;
}
if (fileObject.exists()) {
return;
}
FileObject fileObjectParent = fileObject.getParent();
if (fileObjectParent == null) {
return;
}
fileObjectParent.getType(); // force to attach : needed for force refresh
fileObjectParent.refresh();
}
示例2: delete
import org.apache.commons.vfs2.FileObject; //导入方法依赖的package包/类
/**
* Deletes the data stored in the given file object from the store
*
* @param fo
* the file object to be deleted
*/
void delete(FileObject fo) throws IOException {
FileObject parent = fo.getParent();
fo.delete(Selectors.SELECT_ALL);
while (!parent.equals(baseDirectory)) {
final FileObject[] children = parent.getChildren();
if (children.length > 0) {
break;
}
fo = parent;
parent = fo.getParent();
fo.delete();
}
}