本文整理匯總了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);
}