本文整理了Java中org.eclipse.equinox.internal.p2.core.helpers.FileUtils.copy()
方法的一些代码示例,展示了FileUtils.copy()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FileUtils.copy()
方法的具体详情如下:
包路径:org.eclipse.equinox.internal.p2.core.helpers.FileUtils
类名称:FileUtils
方法名:copy
[英]Copy an input stream to an output stream. Optionally close the streams when done. Return the number of bytes written.
[中]将输入流复制到输出流。完成后可选择关闭流。返回写入的字节数。
代码示例来源:origin: org.eclipse.platform/org.eclipse.equinox.p2.core
public static void copy(File source, File destination, File root, boolean overwrite) throws IOException {
File sourceFile = new File(source, root.getPath());
if (!sourceFile.exists())
throw new FileNotFoundException("Source: " + sourceFile + " does not exist"); //$NON-NLS-1$//$NON-NLS-2$
File destinationFile = new File(destination, root.getPath());
if (destinationFile.exists())
if (overwrite)
deleteAll(destinationFile);
else
throw new IOException("Destination: " + destinationFile + " already exists"); //$NON-NLS-1$//$NON-NLS-2$
if (sourceFile.isDirectory()) {
destinationFile.mkdirs();
File[] list = sourceFile.listFiles();
for (int i = 0; i < list.length; i++)
copy(source, destination, new File(root, list[i].getName()), false);
} else {
destinationFile.getParentFile().mkdirs();
try (InputStream in = new BufferedInputStream(new FileInputStream(sourceFile)); OutputStream out = new BufferedOutputStream(new FileOutputStream(destinationFile));) {
copyStream(in, false, out, false);
}
}
}
代码示例来源:origin: com.github.veithen.cosmos.bootstrap/org.eclipse.equinox.p2.publisher.eclipse
public void makeTemporaryCopy() {
if (isTemporary())
return;
File tempFile = null;
try {
tempFile = File.createTempFile("p2.brandingIron", ""); //$NON-NLS-1$ //$NON-NLS-2$
tempFile.delete();
for (File file : files)
FileUtils.copy(location, tempFile, file, true);
} catch (IOException e) {
LogHelper.log(new Status(IStatus.ERROR, Activator.ID, "Error publishing artifacts", e)); //$NON-NLS-1$
}
location = tempFile;
temporary = true;
}
代码示例来源:origin: com.github.veithen.cosmos.bootstrap/org.eclipse.equinox.p2.core
File[] list = sourceFile.listFiles();
for (int i = 0; i < list.length; i++)
copy(source, destination, new File(root, list[i].getName()), false);
} else {
destinationFile.getParentFile().mkdirs();
代码示例来源:origin: org.eclipse.osgi/org.eclipse.equinox.p2.publisher.eclipse
public void makeTemporaryCopy() {
if (isTemporary())
return;
File tempFile = null;
try {
tempFile = File.createTempFile("p2.brandingIron", ""); //$NON-NLS-1$ //$NON-NLS-2$
tempFile.delete();
for (File file : files)
FileUtils.copy(location, tempFile, file, true);
} catch (IOException e) {
LogHelper.log(new Status(IStatus.ERROR, Activator.ID, "Error publishing artifacts", e)); //$NON-NLS-1$
}
location = tempFile;
temporary = true;
}
代码示例来源:origin: org.eclipse.equinox.p2/core
File[] list = sourceFile.listFiles();
for (int i = 0; i < list.length; i++)
copy(source, destination, new File(root, list[i].getName()), false);
} else {
destinationFile.getParentFile().mkdirs();
代码示例来源:origin: org.eclipse.platform/org.eclipse.equinox.p2.publisher.eclipse
public void makeTemporaryCopy() {
if (isTemporary())
return;
File tempFile = null;
try {
tempFile = File.createTempFile("p2.brandingIron", ""); //$NON-NLS-1$ //$NON-NLS-2$
tempFile.delete();
for (File file : files)
FileUtils.copy(location, tempFile, file, true);
} catch (IOException e) {
LogHelper.log(new Status(IStatus.ERROR, Activator.ID, "Error publishing artifacts", e)); //$NON-NLS-1$
}
location = tempFile;
temporary = true;
}
代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.eclipse.equinox.p2.core
File[] list = sourceFile.listFiles();
for (int i = 0; i < list.length; i++)
copy(source, destination, new File(root, list[i].getName()), false);
} else {
destinationFile.getParentFile().mkdirs();
内容来源于网络,如有侵权,请联系作者删除!