Recent Posts

RSS Feeds

Creating Zip Files

Well I have gone through this before but having just gone throug this again I figured I'd blog it so I wont forget the next time. I have been creating a zip of former log files so I don't loose them, i.e. app starts and runs and writes to a log. The next startup takes the existing log and adds it to a zip file then creates a new one so I have the old log (compressed) and a new log. OK, enough of that. To make the above process work;

If the log file exists
    open a byte array stream to copy to
    open a zip output stream using the byte array as the back end
    copy the entries from the old file to the buffer
      open a ZipFile on the .zip file
      get the enumeration for the entries and iterate
        get the input stream for the entry
        add an entry to the new zip stream
        read the input stream and write it to the zip stream
        close the entry
    add the existing log file to the buffer
      add the entry
      write the file to the zip output stream
    close the zip output stream
    write the buffer to the existing zip file (i.e. override)
I could put code but its too much with all the exception handling etc.

Permalink     No Comments

Sending books out today

Sending copies of the books out today to my friend Sam Griffith and Tom @ java ranch.

Permalink     No Comments

java.net?

Just sent email to Daniel Steinberg @ java.net asking to promote the book or get a blog. Hope to be able to contribuite!

Permalink     No Comments

Let it snow, let it snow, let it snow :-)

It snowed at peak 8, 9 and 10 last night. It was a absolutely beautiful thing to see.

I love the mountains! Here is a picture of what things looked around 1:00pm after the snow clouds lifted. Fantastic!

Permalink     No Comments