@Test public void testCopyStream() throws IOException { File tempDir = Files.createTempDir(); tempDir.deleteOnExit(); File subFile1 = new File(tempDir, "subFile1"); Files.write(SOME_BYTES, subFile1); File subFile2 = new File(tempDir, "subFile2"); IOUtils.copyURLToFile(subFile1.toURI().toURL(), subFile2); ByteArrayOutputStream baos = new ByteArrayOutputStream(); Files.copy(subFile2, baos); assertArrayEquals(SOME_BYTES, baos.toByteArray()); }
public static void copyURLToFile(URL url, File file) throws IOException { InputStream in = url.openStream(); try { copyStreamToFile(in, file); } finally { in.close(); } }
IOUtils { public static void copyURLToFile(URL url, File file) throws IOException { InputStream in = url.openStream(); try { copyStreamToFile(in, file); } finally { in.close(); } } }
IOUtils { public static void copyURLToFile(URL url, File file) throws IOException { InputStream in = url.openStream(); try { copyStreamToFile(in, file); } finally { in.close(); } } private  IOUtils(); }
IOUtils { public static void copyURLToFile(URL url, File file) throws IOException { InputStream in = url.openStream(); try { copyStreamToFile(in, file); } finally { in.close(); } } private  IOUtils(); static void deleteRecursively(File dir); static void delete(File file); static InputStream openMaybeDecompressing(File file); static Reader openReaderMaybeDecompressing(File file); static void copyStreamToFile(InputStream in, File file); static void copyURLToFile(URL url, File file); static void mkdirs(File dir); static GZIPOutputStream buildGZIPOutputStream(OutputStream delegate); static Writer buildGZIPWriter(OutputStream delegate); static Writer buildGZIPWriter(File file); static BufferedReader buffer(Reader maybeBuffered); static boolean isGZIPFileEmpty(File f); }
IOUtils { public static void copyURLToFile(URL url, File file) throws IOException { InputStream in = url.openStream(); try { copyStreamToFile(in, file); } finally { in.close(); } } private  IOUtils(); static void deleteRecursively(File dir); static void delete(File file); static InputStream openMaybeDecompressing(File file); static Reader openReaderMaybeDecompressing(File file); static void copyStreamToFile(InputStream in, File file); static void copyURLToFile(URL url, File file); static void mkdirs(File dir); static GZIPOutputStream buildGZIPOutputStream(OutputStream delegate); static Writer buildGZIPWriter(OutputStream delegate); static Writer buildGZIPWriter(File file); static BufferedReader buffer(Reader maybeBuffered); static boolean isGZIPFileEmpty(File f); static final FilenameFilter CSV_COMPRESSED_FILTER; static final FilenameFilter NOT_HIDDEN; }