2

I have a java WAR file and I want to edit a file in it without decompressing it. Because the file is large it can take a long time to decompress and compress it again. I use SharpZipLib in C# for working with zip files, but I can't find a solution to edit some data in internal folders. For example I want to edit a file with this path: file.war\dir1\dir2\a.txt and replace some text in it. do you have any solution?

EDIT:

It may be irrelevant, but I am almost sure this can be implemented, because I searched and found that WinRAR Software has this capability.

geedubb
  • 4,048
  • 4
  • 27
  • 38
YoRe
  • 39
  • 6
  • Would you be able to extract just that file, edit it, and zip it again? – hmartinezd Jan 16 '15 at 20:32
  • I think i did not understand what you mean@hmartinezd , can you explain more? how can i do that? – YoRe Jan 16 '15 at 21:01
  • Well, actually you may be right, is probably that unzipping a single file will take as long as unzipping then all. But that's something I am not completely sure. – hmartinezd Jan 16 '15 at 21:17
  • This may help: http://stackoverflow.com/questions/5967864/how-to-read-data-from-a-zip-file-without-having-to-unzip-the-entire-file – geedubb Jan 17 '15 at 11:47
  • Extract, alter, delete original, re-add might work. You can't just "remove" bytes in the middle of a file though, so the archive might get larger with each operation. – CodeCaster Jan 17 '15 at 12:14
  • 1
    I am also looking for the exact same thing. i am making a tool to automatically set beans.xml attributes... it is possible manually with 7ZIP- open archive and edit the file, but what i believe they do is extract the file into temp directory and let you edit it, when you close the editor the add it back to the archive. – eladyanai Apr 19 '15 at 09:16

0 Answers0