Results 1 to 6 of 6
- 08-20-2010, 02:33 PM #1
Member
- Join Date
- Aug 2010
- Posts
- 4
- Rep Power
- 0
add to a zip file without copying it.
My program should work with a zip file about 300 mb.
the zip is updated many times during the execution and I need a way to introduce the zip files without copying the entire file again.
I tried the library "TrueZip" with this code:
I tried not to create a new file in the archiveCopyTo method () but if you tell the original zip file does not flinchJava Code:import de.schlichtherle.io.File; public class Main { public static void main(String[] args) { File zip = new File ("c:/zip/zip.zip"); File add = new File ("c:/prueba.txt"); add.archiveCopyTo(new File (zip,"prueba.txt")); } }
can add files but it takes about 16 seconds to add a 1kb text file to my 300mb zip that creates the zip again.
Does anyone have a solution to my problem?
Sorry for my bad English.
thanks
- 08-20-2010, 02:49 PM #2
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,405
- Blog Entries
- 7
- Rep Power
- 17
As you could've seen in the API documentation for all the Zip* entries there is no functionality implemented for just updating entries in a .zip file.
kind regards,
Jos
- 08-20-2010, 03:47 PM #3
Member
- Join Date
- Aug 2010
- Posts
- 4
- Rep Power
- 0
thanks for response :D
there is some unofficial library? or all to copy the entire file again?
:(
- 08-20-2010, 03:51 PM #4
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,405
- Blog Entries
- 7
- Rep Power
- 17
- 08-20-2010, 04:28 PM #5
Member
- Join Date
- Aug 2010
- Posts
- 4
- Rep Power
- 0
I'm afraid I'm going to have to program in Python, I still hear some possible solutions, as I would like to develop in Java
Very thanks Jos!
- 08-21-2010, 03:16 AM #6
Member
- Join Date
- Aug 2010
- Posts
- 4
- Rep Power
- 0
Hello!
I found half a solution.
I used the Jython library.
add python zip files is very simple (3 lines).
I am new to java so I do not know if it will be well structured or I'm missing something. for now I've tried works
I leave a simple example if someone has the same problem.
Java Code:public static void addFileToZip(String zipRoute, String addRoute){ PythonInterpreter py = new PythonInterpreter(); py.exec("import zipfile"); py.exec("z = zipfile.ZipFile('"+zipRoute+"','a')"); py.exec("z.write('"+addRoute+"')"); py.exec("z.close()"); }
Similar Threads
-
Copying a file (.docx) from computers
By chyrl in forum NetworkingReplies: 3Last Post: 07-02-2010, 02:02 PM -
problems copying a file
By atom86 in forum Advanced JavaReplies: 16Last Post: 10-01-2009, 02:40 PM -
Creating Folder in JAVA and Copying File
By fnoman in forum New To JavaReplies: 8Last Post: 10-18-2008, 07:33 AM -
copying file from a email/word to a Java application
By cmbl in forum Advanced JavaReplies: 13Last Post: 01-09-2008, 06:51 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks