diff --git a/ZipFileManipulator.java b/ZipFileManipulator.java index 3aae8b0..8c817b3 100644 --- a/ZipFileManipulator.java +++ b/ZipFileManipulator.java @@ -36,4 +36,18 @@ public class ZipFileManipulator { Files.copy(source, outputLocation.toPath()); } + public void insertFile(String targetFile) throws Exception { + Path myFilePath = Paths.get(targetFile); + + Path zipFilePath = Paths.get(this.fileName); + try( FileSystem fs = FileSystems.newFileSystem(zipFilePath, null) ){ + Path fileInsideZipPath = fs.getPath("/ppt/" + targetFile); + Files.delete(fileInsideZipPath); + Files.copy(myFilePath, fileInsideZipPath); + + } catch (IOException e) { + e.printStackTrace(); + } + } + } \ No newline at end of file