本文整理汇总了Java中com.intellij.openapi.util.io.FileUtil.copyContent方法的典型用法代码示例。如果您正苦于以下问题:Java FileUtil.copyContent方法的具体用法?Java FileUtil.copyContent怎么用?Java FileUtil.copyContent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.openapi.util.io.FileUtil
的用法示例。
在下文中一共展示了FileUtil.copyContent方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: copyFile
import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
public void copyFile(File file, Ref<File> targetFileRef, ResourceRootConfiguration rootConfiguration, CompileContext context,
FileFilter filteringFilter) throws IOException {
boolean shouldFilter = rootConfiguration.isFiltered && !rootConfiguration.filters.isEmpty() && filteringFilter.accept(file);
if (shouldFilter && file.length() > FILTERING_SIZE_LIMIT) {
context.processMessage(new CompilerMessage(
GradleResourcesBuilder.BUILDER_NAME, BuildMessage.Kind.WARNING,
"File is too big to be filtered. Most likely it is a binary file and should be excluded from filtering", file.getPath())
);
shouldFilter = false;
}
if (shouldFilter) {
copyWithFiltering(file, targetFileRef, rootConfiguration.filters, context);
}
else {
FileUtil.copyContent(file, targetFileRef.get());
}
}
示例2: copyFile
import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
public void copyFile(File file, File targetFile, ResourceRootConfiguration rootConfiguration, CompileContext context,
FileFilter filteringFilter) throws IOException {
boolean shouldFilter = rootConfiguration.isFiltered && !myFilteringExcludedExtensions.contains(FileUtilRt.getExtension(file.getName()))
&& filteringFilter.accept(file);
if (shouldFilter && file.length() > FILTERING_SIZE_LIMIT) {
context.processMessage(new CompilerMessage("MavenResources", BuildMessage.Kind.WARNING,
"File is too big to be filtered. Most likely it is a binary file and should be excluded from filtering",
file.getPath()));
shouldFilter = false;
}
if (shouldFilter) {
copyWithFiltering(file, targetFile);
}
else {
FileUtil.copyContent(file, targetFile);
}
}
示例3: copyResource
import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
private static void copyResource(CompileContext context, ResourceRootDescriptor rd, File file, BuildOutputConsumer outputConsumer) throws IOException {
final File outputRoot = rd.getTarget().getOutputDir();
if (outputRoot == null) {
return;
}
final String sourceRootPath = FileUtil.toSystemIndependentName(rd.getRootFile().getAbsolutePath());
final String relativePath = FileUtil.getRelativePath(sourceRootPath, FileUtil.toSystemIndependentName(file.getPath()), '/');
final String prefix = rd.getPackagePrefix();
final StringBuilder targetPath = new StringBuilder();
targetPath.append(FileUtil.toSystemIndependentName(outputRoot.getPath()));
if (prefix.length() > 0) {
targetPath.append('/').append(prefix.replace('.', '/'));
}
targetPath.append('/').append(relativePath);
context.processMessage(new ProgressMessage("Copying resources... [" + rd.getTarget().getModule().getName() + "]"));
final String outputPath = targetPath.toString();
final File targetFile = new File(outputPath);
FileUtil.copyContent(file, targetFile);
try {
outputConsumer.registerOutputFile(targetFile, Collections.singletonList(file.getPath()));
}
catch (Exception e) {
context.processMessage(new CompilerMessage(BUILDER_NAME, e));
}
}
示例4: rename
import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
protected static void rename(String path, String newName) {
try {
File file = new File(FileUtil.toSystemDependentName(path));
assertTrue("File " + file.getAbsolutePath() + " doesn't exist", file.exists());
final File tempFile = new File(file.getParentFile(), "__" + newName);
FileUtil.rename(file, tempFile);
File newFile = new File(file.getParentFile(), newName);
FileUtil.copyContent(tempFile, newFile);
FileUtil.delete(tempFile);
change(newFile.getPath());
}
catch (IOException e) {
throw new RuntimeException(e);
}
}
示例5: copyFile
import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
@Override
public void copyFile(@NotNull File from, @NotNull File to, @NotNull CompileContext context) throws IOException {
FileUtil.copyContent(from, to);
}