@Test void canCopyResources(@TempDirectory Path tempDir) throws Exception { Path file = copyResource("net/consensys/cava/io/file/test.txt", tempDir.resolve("test.txt")); assertTrue(Files.exists(file)); assertEquals(81, Files.size(file)); }
public static Path copyResource(String resourceName, Path destination, OpenOption... options) throws IOException { requireNonNull(resourceName); requireNonNull(destination); try (OutputStream out = java.nio.file.Files.newOutputStream(destination, options)) { copyResource(resourceName, out); } return destination; }
Files { public static Path copyResource(String resourceName, Path destination, OpenOption... options) throws IOException { requireNonNull(resourceName); requireNonNull(destination); try (OutputStream out = java.nio.file.Files.newOutputStream(destination, options)) { copyResource(resourceName, out); } return destination; } }
Files { public static Path copyResource(String resourceName, Path destination, OpenOption... options) throws IOException { requireNonNull(resourceName); requireNonNull(destination); try (OutputStream out = java.nio.file.Files.newOutputStream(destination, options)) { copyResource(resourceName, out); } return destination; } private  Files(); }
Files { public static Path copyResource(String resourceName, Path destination, OpenOption... options) throws IOException { requireNonNull(resourceName); requireNonNull(destination); try (OutputStream out = java.nio.file.Files.newOutputStream(destination, options)) { copyResource(resourceName, out); } return destination; } private  Files(); static boolean createFileIfMissing(Path path, FileAttribute<?>... attrs); static void deleteRecursively(Path directory); static Path copyResource(String resourceName, Path destination, OpenOption... options); static long copyResource(String resourceName, OutputStream out); static void atomicReplace(Path path, byte[] bytes); static void atomicReplace(Path path, IOConsumer<Writer> fn); static void atomicReplace(Path path, Charset charset, IOConsumer<Writer> fn); }
Files { public static Path copyResource(String resourceName, Path destination, OpenOption... options) throws IOException { requireNonNull(resourceName); requireNonNull(destination); try (OutputStream out = java.nio.file.Files.newOutputStream(destination, options)) { copyResource(resourceName, out); } return destination; } private  Files(); static boolean createFileIfMissing(Path path, FileAttribute<?>... attrs); static void deleteRecursively(Path directory); static Path copyResource(String resourceName, Path destination, OpenOption... options); static long copyResource(String resourceName, OutputStream out); static void atomicReplace(Path path, byte[] bytes); static void atomicReplace(Path path, IOConsumer<Writer> fn); static void atomicReplace(Path path, Charset charset, IOConsumer<Writer> fn);  }