I want to edit a file "application.properties" inside "imp" directory inside a zip "archive.zip". I'm using Truezip for this. I tried using both TFileOutputStream and TFileWriter. But both of them are creating a tmp file, but not editing the actual file in zip. The actual file in zip still remains same. Below are my code samples: 1. Using TFileOutputStream:
OutputStream out = new TFileOutputStream("C:\sample\archive.zip\imp\application.properties");
// Loading properties code here
properties.store(out, null);
out.close();
File entry = new TFile("C:\sample\archive.zip\imp\application.properties"); Writer writer = new TFileWriter(entry); try { writer.write("wish.world=Hello world\n"); } finally { writer.close(); }
Kindly help.
You need to call TVFS.umount()
to persist your changes.