Java Code Examples for com.intellij.openapi.util.io.FileUtilRt#copy()
The following examples show how to use
com.intellij.openapi.util.io.FileUtilRt#copy() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ZipUtil.java From consulo with Apache License 2.0 | 6 votes |
@Nullable public static File compressFile(@Nonnull File srcFile, @Nonnull File zipFile) throws IOException { InputStream is = new FileInputStream(srcFile); try { ZipOutputStream os = new ZipOutputStream(new FileOutputStream(zipFile)); try { os.putNextEntry(new ZipEntry(srcFile.getName())); FileUtilRt.copy(is, os); os.closeEntry(); return zipFile; } finally { os.close(); } } finally { is.close(); } }
Example 2
Source File: Restarter.java From consulo with Apache License 2.0 | 5 votes |
public static File createTempExecutable(File executable) throws IOException { String ext = FileUtilRt.getExtension(executable.getName()); File copy = FileUtilRt.createTempFile(FileUtilRt.getNameWithoutExtension(executable.getName()), StringUtil.isEmptyOrSpaces(ext) ? ".tmp" : ("." + ext), false); FileUtilRt.copy(executable, copy); if (!copy.setExecutable(executable.canExecute())) throw new IOException("Cannot make file executable: " + copy); return copy; }