本文整理了Java中org.openide.filesystems.FileUtil.copyAttributes()
方法的一些代码示例,展示了FileUtil.copyAttributes()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FileUtil.copyAttributes()
方法的具体详情如下:
包路径:org.openide.filesystems.FileUtil
类名称:FileUtil
方法名:copyAttributes
[英]Copies attributes from one file to another. Note: several special attributes will not be copied, as they should semantically be transient. These include attributes used by the template wizard (but not the template attribute itself).
[中]将属性从一个文件复制到另一个文件。注意:一些特殊属性不会被复制,因为它们在语义上应该是暂时的。这些属性包括模板向导使用的属性(但不包括模板属性本身)。
代码示例来源:origin: org.netbeans.api/org-openide-filesystems
copyAttributes(source, dest);
} finally {
if (bufIn != null) {
代码示例来源: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: org.netbeans.modules/org-netbeans-modules-templates
private static void setTemplateAttributes(FileObject fo, FileObject from) throws IOException {
FileUtil.copyAttributes(from, fo);
fo.setAttribute(TEMPLATE_LOCALIZING_BUNDLE_ATTRIBUTE, null);
}
代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide-loaders
FileUtil.copyAttributes (getFile (), fo);
代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide-loaders
/** Creates new folder and copies attributes.
* @param f the folder to create this entry in
* @param suffix suffix appended to the new name to use
* @return the copied <code>FileObject</code> or <code>null</code> if it cannot be copied
* @exception IOException when the operation fails
*/
public FileObject copy (FileObject f, String suffix) throws IOException {
String add = suffix + ((getFile ().getExt ().length () > 0) ? "." + getFile ().getExt () : "");
FileObject fo = FileUtil.createFolder (f, getFile ().getName () + add);
FileUtil.copyAttributes (getFile (), fo);
return fo;
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd-source
FileUtil.copyAttributes(getFile(), fo);
代码示例来源:origin: net.sf.squirrel-sql.thirdpary-non-maven/openide
copyAttributes (source, dest);
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd
FileUtil.copyAttributes(getFile(), fo);
代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide
copyAttributes (source, dest);
代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide-loaders
/** Restore entries from the list. If Entry.getFile () has changed from
* time when backup list was created, original file is restored and
* Entry is re-assigned to it.
* @param backup list obtained from {@link #saveEntries ()} function
*/
final void restoreEntries(List backup) {
Iterator it = backup.iterator ();
while (it.hasNext ()) {
Pair p = (Pair)it.next ();
if (p.entry.getFile ().equals (p.file))
continue;
if (p.file.isValid()) {
p.entry.changeFile (p.file);
} else {
// copy back
try {
if (p.entry.getFile ().isData ())
p.entry.changeFile (p.entry.getFile ().copy (p.file.getParent (), p.file.getName (), p.file.getExt ()));
else {
FileObject fo = p.file.getParent ().createFolder (p.file.getName ());
FileUtil.copyAttributes (p.entry.getFile (), fo);
p.entry.changeFile (fo);
}
} catch (IOException e) {
// should not occure
}
}
}
}
代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide-loaders
/** Creates new folder and copies attributes, the template flag is cleared.
* @param f the folder to create this entry in
* @param name the new name to use
* @return the copied <code>FileObject</code> or <code>null</code> if it cannot be copied
* @exception IOException when the operation fails
*/
public FileObject createFromTemplate (FileObject f, String name) throws IOException {
if (name == null) {
name = FileUtil.findFreeFileName(
f,
getFile ().getName (), getFile ().getExt ()
);
}
FileObject fo = FileUtil.createFolder (f, name);
FileUtil.copyAttributes (getFile (), fo);
DataObject.setTemplate (fo, false);
return fo;
}
内容来源于网络,如有侵权,请联系作者删除!