当前位置: 首页>>代码示例>>Java>>正文


Java FileObject.delete方法代码示例

本文整理汇总了Java中org.apache.commons.vfs2.FileObject.delete方法的典型用法代码示例。如果您正苦于以下问题:Java FileObject.delete方法的具体用法?Java FileObject.delete怎么用?Java FileObject.delete使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.commons.vfs2.FileObject的用法示例。


在下文中一共展示了FileObject.delete方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: delete

import org.apache.commons.vfs2.FileObject; //导入方法依赖的package包/类
/**
 * Delete all descendents of this file that match a selector.
 * 
 * @param file the file
 * @param selector the selector
 * 
 * @return true, if successful
 * @throws MotuException
 */
public boolean delete(FileObject file, FileSelector selector) throws MotuException {
    if (LOG.isDebugEnabled()) {
        LOG.debug("delete(FileObject, FileSelector) - entering");
    }

    int deleted = 0;
    try {
        if (file.exists()) {
            deleted = file.delete(selector);
        }
    } catch (FileSystemException e) {
        LOG.error("delete(FileObject, FileSelector)", e);

        // throw new MotuException(String.format("Unable to copy file '%s' to '%s'",
        // foSrc.getURL().toString(), foDest.getURL().toString()), e);
        throw new MotuException(ErrorType.NETCDF_LOADING, String.format("Unable to delete '%s'", file.getName().toString()), e);
    }
    boolean returnboolean = (deleted > 0);
    if (LOG.isDebugEnabled()) {
        LOG.debug("delete(FileObject, FileSelector) - exiting");
    }
    return returnboolean;
}
 
开发者ID:clstoulouse,项目名称:motu,代码行数:33,代码来源:VFSManager.java

示例2: remove

import org.apache.commons.vfs2.FileObject; //导入方法依赖的package包/类
@Override
public void remove(String noteId) throws IOException {
  FileObject rootDir = fsManager.resolveFile(getPath("/"));
  FileObject noteDir = rootDir.resolveFile(noteId, NameScope.CHILD);

  if (!noteDir.exists()) {
    // nothing to do
    return;
  }

  if (!isDirectory(noteDir)) {
    // it is not look like zeppelin note savings
    throw new IOException("Can not remove " + noteDir.getName().toString());
  }

  noteDir.delete(Selectors.SELECT_SELF_AND_CHILDREN);
}
 
开发者ID:lorthos,项目名称:incubator-zeppelin-druid,代码行数:18,代码来源:VFSNotebookRepo.java

示例3: 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();
    }
}
 
开发者ID:MyCoRe-Org,项目名称:mycore,代码行数:21,代码来源:MCRStore.java

示例4: doDeleteContent

import org.apache.commons.vfs2.FileObject; //导入方法依赖的package包/类
@Override
protected void doDeleteContent(String storageId) throws Exception {
    FileObject targetObject = fsManager.resolveFile(getBase(), storageId);
    LOGGER.debug("Delete fired on: {}", targetObject);
    LOGGER.debug("targetObject.class = {}", targetObject.getClass().getName());
    if (targetObject.delete()) {
        LOGGER.debug("Delete of {} was successful.", targetObject);
    } else {
        LOGGER.warn("Delete of {} was NOT successful (w/o errors given).", targetObject);
    }
}
 
开发者ID:MyCoRe-Org,项目名称:mycore,代码行数:12,代码来源:MCRCStoreVFS.java

示例5: deleteFile

import org.apache.commons.vfs2.FileObject; //导入方法依赖的package包/类
/**
 * Delete the file repsented by the file parameter.
 * 
 * @param file the file
 * 
 * @return true, if successful
 * @throws MotuException
 */
public boolean deleteFile(FileObject file) throws MotuException {
    if (LOG.isDebugEnabled()) {
        LOG.debug("deleteFile(FileObject) - entering");
    }

    boolean deleted = false;
    try {

        if (file.exists()) {
            if (file.getType() != FileType.FILE) {
                throw new MotuException(
                        ErrorType.NETCDF_LOADING,
                        String.format("Delete file '%s' is rejected: it is a folder. ", file.getName().toString()));
            }

            deleted = file.delete();
        }
    } catch (FileSystemException e) {
        LOG.error("deleteFile(FileObject)", e);

        // throw new MotuException(String.format("Unable to copy file '%s' to '%s'",
        // foSrc.getURL().toString(), foDest.getURL().toString()), e);
        throw new MotuException(ErrorType.NETCDF_LOADING, String.format("Unable to delete '%s'", file.getName().toString()), e);
    }

    if (LOG.isDebugEnabled()) {
        LOG.debug("deleteFile(FileObject) - exiting");
    }
    return deleted;
}
 
开发者ID:clstoulouse,项目名称:motu,代码行数:39,代码来源:VFSManager.java


注:本文中的org.apache.commons.vfs2.FileObject.delete方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。