org.openide.filesystems.FileUtil.copyFileImpl()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(2.6k)|赞(0)|评价(0)|浏览(136)

本文整理了Java中org.openide.filesystems.FileUtil.copyFileImpl()方法的一些代码示例,展示了FileUtil.copyFileImpl()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FileUtil.copyFileImpl()方法的具体详情如下:
包路径:org.openide.filesystems.FileUtil
类名称:FileUtil
方法名:copyFileImpl

FileUtil.copyFileImpl介绍

[英]Copies file to the selected folder. This implementation simply copies the file by stream content.
[中]将文件复制到所选文件夹。此实现只需按流内容复制文件。

代码示例

代码示例来源:origin: org.netbeans.api/org-openide-filesystems

/** Copies this file. This allows the filesystem to perform any additional
* operation associated with the copy. But the default implementation is simple
* copy of the file and its attributes
*
* @param target target folder to move this file to
* @param name new basename of file
* @param ext new extension of file (ignored for folders)
* @return the newly created file object representing the moved file
*/
public FileObject copy(FileObject target, String name, String ext)
throws IOException {
  if (isFolder()) {
    if (FileUtil.isParentOf(this, target)) {
      throw new FSException(NbBundle.getMessage(FileObject.class, "EXC_OperateChild", this, target)); // NOI18N
    }
    FileObject peer = target.createFolder(name);
    FileUtil.copyAttributes(this, peer);
    for (FileObject fo : getChildren()) {
      fo.copy(peer, fo.getName(), fo.getExt());
    }
    return peer;
  }
  FileObject dest = FileUtil.copyFileImpl(this, target, name, ext);
  return dest;
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide

/** Copies this file. This allows the filesystem to perform any additional
* operation associated with the copy. But the default implementation is simple
* copy of the file and its attributes
* 
* @param target target folder to move this file to
* @param name new basename of file
* @param ext new extension of file (ignored for folders)
* @return the newly created file object representing the moved file
*/
public FileObject copy (FileObject target, String name, String ext)
throws IOException {
  if (isFolder()) {
    throw new IOException(NbBundle.getBundle(FileObject.class).getString("EXC_FolderCopy"));
  }
  FileObject dest = FileUtil.copyFileImpl (this, target, name, ext);
  return dest;
}

代码示例来源:origin: net.sf.squirrel-sql.thirdpary-non-maven/openide

/** Copies this file. This allows the filesystem to perform any additional
* operation associated with the copy. But the default implementation is simple
* copy of the file and its attributes
* 
* @param target target folder to move this file to
* @param name new basename of file
* @param ext new extension of file (ignored for folders)
* @return the newly created file object representing the moved file
*/
public FileObject copy (FileObject target, String name, String ext)
throws IOException {
  if (isFolder()) {
    throw new IOException(NbBundle.getBundle(FileObject.class).getString("EXC_FolderCopy"));
  }
  FileObject dest = FileUtil.copyFileImpl (this, target, name, ext);
  return dest;
}

相关文章