/** * Copies a stream to a destination * * @param stream the stream * @param destination the destination * @throws IOException if there is an error copying */ private static void copy(InputStream stream, File destination) throws IOException { try (OutputStream os = new BufferedOutputStream(new FileOutputStream(destination))) { IOHelper.copy(stream, os); os.flush(); } destination.deleteOnExit(); }
try (FileInputStream input = new FileInputStream(srcFile)) { output = new FileOutputStream(destFile); IOHelper.copy(input, output); } catch (IOException e) { throw new Fabric3Exception(e);