/** * Copies content of resource to the given file * * @param file to copy to * @param resourceUrl url of the resource to be copied * @throws java.io.IOException if resource not found or copying failed */ public static void copyFromResource( @NotNull VirtualFile file, @NonNls @NotNull String resourceUrl) throws IOException { InputStream out = VfsUtil.class.getResourceAsStream(resourceUrl); if (out == null) { throw new FileNotFoundException(resourceUrl); } try { byte[] bytes = FileUtil.adaptiveLoadBytes(out); file.setBinaryContent(bytes); } finally { out.close(); } }