Results 1 to 4 of 4
Thread: Partial copy of zip archive
- 02-05-2013, 06:11 PM #1
Member
- Join Date
- Feb 2013
- Posts
- 3
- Rep Power
- 0
Partial copy of zip archive
Hello there,
I'm trying to automatize some custom changes to eBooks in the epub format. Since .epub is zip-compressed I simple opened it with a ZipFile. I can parse filenames from ZipEntries and am able to open FileInputStreams to those files.
Now I want to do the following:
+ Open zip file (works)
+ Create a new .zip archive (works)
Then, I parse all ZipEntries and want to apply the following steps
+ Read and edit if the file is a .html file (works)
- Save edited .html files into the new archive (doesn't work yet)
- "Simply" copy all other files into the new archive, keeping achive structure (doesn't work yet)
So my questions are:
Is there any way to simply copy the files over without creating a reading them bytewise and writing them to a ZipOutputStream?
Is there a way to read the .html files linewise, edit them linewise and output them linewise into the new zip archive? Do I need to write them to a temporary file and copy that back into the .zip?
When exactly is compression and decompression applied?
I'd be grateful for any ideas, since I'm not new to java but never ever bothered with zip-file handling. Tnx!
- 02-05-2013, 06:34 PM #2
Senior Member
- Join Date
- Feb 2009
- Posts
- 303
- Rep Power
- 5
Re: Partial copy of zip archive
I would try instead of creating a new .zip archive, creating the folder and all the Files first, then zipping the folder to form the archive.
- 02-05-2013, 07:00 PM #3
Member
- Join Date
- Feb 2013
- Posts
- 3
- Rep Power
- 0
Re: Partial copy of zip archive
Interesting, that idea never occured to me.
Could I zip the whole folder in one go?
- 02-05-2013, 07:24 PM #4
Senior Member
- Join Date
- Feb 2009
- Posts
- 303
- Rep Power
- 5
Re: Partial copy of zip archive
Actually, nevermind. It's been awhile since I worked with zipping files, but I created a method that does this.
Basically, you would just create a ZipEntry for each File being zipped, with the path relative to the Folder being zipped. The data is still transferred using the ZipOutputStream, bytewise.
Similar Threads
-
How to get large data from WCF webservice partial?
By mnd017 in forum JavaServer Faces (JSF)Replies: 0Last Post: 01-06-2013, 10:17 PM -
KeyListener partial problem
By alphasil in forum AWT / SwingReplies: 2Last Post: 12-13-2012, 01:05 AM -
Partial message problem using nio socket
By perl010101 in forum New To JavaReplies: 0Last Post: 05-25-2011, 09:26 PM -
partial XML validation against xsd
By presto in forum XMLReplies: 2Last Post: 11-21-2009, 05:15 PM -
HELP: Trouble with partial filled arrays
By daigre7 in forum New To JavaReplies: 1Last Post: 04-07-2008, 02:05 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks