0

I want to change several lines in several files in several archives. I could do it by unpacking to a temp-location, changing, and repacking.

However, I got the impression that by using truezip, I should be able to do this kind of handling in-place.

Can any of you help?

ShadowFlame
  • 2,996
  • 5
  • 26
  • 40
  • http://truezip.java.net/kick-start/tutorial.html – Keppil Sep 28 '12 at 10:29
  • gives a nice way how to insert, delete and read files, but not how to update an existing line in an existing file without exporting said file.. – ShadowFlame Sep 28 '12 at 10:34
  • It also says how to update a file. Do you want something more in-place than reading the individual files and writing back the updated versions? – Keppil Sep 28 '12 at 10:38
  • this way you still have a temporary file outside of the archive, that you need to overwrite the original with. If this is the only possibility, so be it. – ShadowFlame Sep 28 '12 at 10:42
  • 1
    Typically you would use a TFileInputStream or TFileReader to read the archive entry to memory, update it and then write back the result with a TFileOutputStream or a TFileWriter. – Christian Schlichtherle Sep 28 '12 at 18:46
  • Alternatively, you could use the TPath API and use Files.newByteChannel to request a SeekableByteChannel. – Christian Schlichtherle Sep 28 '12 at 18:48
  • a lot of options. Going to try some after the weekend, and keep you posted on my choice. – ShadowFlame Sep 29 '12 at 06:04
  • I'm curious about how you solved this. – l15a Apr 15 '13 at 16:39
  • IIRC, I'd have to look at the code to be certain, is to make a temporary file, do a find and replace in the most inefficient way possible(loop over lines) and store it again. – ShadowFlame Apr 16 '13 at 05:05

0 Answers0