
1. Из Path в OutputStream;
2. Из InputStream в Path;
3. Из Path в Path;
// 1. Из Path в OutputStream
Path in = Paths.get("document.txt");
FileOutputStream out = new FileOutputStream("document_copy.txt");
Files.copy(in, out);
// 2. Из InputStream в Path;
FileInputStream in = new FileInputStream("myPhoto.jpg");
Path out = Paths.get("myPhoto_copy.jpg");
Files.copy(in, out);
// 3. Из Path в Path;
Path in = Paths.get("book.pdf");
Path out = Paths.get("book_copy.pdf");
Files.copy(in, out);