Results 1 to 4 of 4
  1. #1
    nmn
    nmn is offline Member
    Join Date
    Feb 2013
    Posts
    3
    Rep Power
    0

    Lightbulb 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!

  2. #2
    StormyWaters is offline Senior Member
    Join Date
    Feb 2009
    Posts
    307
    Rep Power
    6

    Default 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.

  3. #3
    nmn
    nmn is offline Member
    Join Date
    Feb 2013
    Posts
    3
    Rep Power
    0

    Default Re: Partial copy of zip archive

    Interesting, that idea never occured to me.
    Could I zip the whole folder in one go?

  4. #4
    StormyWaters is offline Senior Member
    Join Date
    Feb 2009
    Posts
    307
    Rep Power
    6

    Default 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

  1. How to get large data from WCF webservice partial?
    By mnd017 in forum JavaServer Faces (JSF)
    Replies: 0
    Last Post: 01-06-2013, 11:17 PM
  2. KeyListener partial problem
    By alphasil in forum AWT / Swing
    Replies: 2
    Last Post: 12-13-2012, 02:05 AM
  3. Partial message problem using nio socket
    By perl010101 in forum New To Java
    Replies: 0
    Last Post: 05-25-2011, 10:26 PM
  4. partial XML validation against xsd
    By presto in forum XML
    Replies: 2
    Last Post: 11-21-2009, 06:15 PM
  5. HELP: Trouble with partial filled arrays
    By daigre7 in forum New To Java
    Replies: 1
    Last Post: 04-07-2008, 03:05 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •