Keith Blount wrote:

Anyway, my question is, is there a happy medium between the single file format and the file package?


Some archive formats support an index or table-of-contents, others don't.

To use an index or TOC, you load only the index data into memory, and subsequently load only the file-data as needed. This is a common strategy in many different situations. It's how file-systems work, for example: a directory-entry is small, the data referred to can be large.

If you must break the data itself down into smaller manageable chunks, such as to avoid decompressing many hundreds of megabytes at once, then you need to apply this breakdown recursively. That is, large data is broken into separately readable and decompressible chunks, say at 4 MB boundaries in the original uncompressed data. You then examine the seek/read address, choose a block, and only decompress that block.

Storing modified pieces into a compressed archive brings difficulties. How to reclaim now-unused space, how to overwrite a block with larger data, etc. Pretty soon you're doing all the space- management that a file-system does, so consider using an actual file- system, i.e. a disk-image file. Or if that's unsuitable, you'll have to learn about the basics of space-management employed by file- systems and databases, where efficient allocation and reuse of blocks is well-known and commonly described.


What I was wondering is if it would be possible to use a zipped format instead.


It is possible. Whether this will work in your situation, only you can evaluate and decide.

If this is really the direction you want to take, you need to dig into it more. You are not going to get away with just invoking NSTask on the 'zip' command.

The ZIP format is documented. So are other formats like cpio, tar, gzip, and so on. You will have to thoroughly understand the formats, their reuse of space, and the tradeoffs.

http://en.wikipedia.org/wiki/List_of_archive_formats


And is it possible to place data into an existing zip archive without writing the data to disk as a file first, and without having to recreate the entire zip file? (I am sure it is possible, so, to put it another way:
 is it possible with the tools readily available?

With Google, almost anything is readily available.

Do you understand the actual mechanics of the ZIP format? Have you read the headers for the zip API provided with Mac OS X? These can easily be answered with a little googling and reading.

The ZIP format allows updates, but they are usually appended, not overwritten on top of past entries. This causes the zip-file to grow until you eventually rebuild it with the outdated entries removed.

  -- GG

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to