Archived

This topic is now archived and is closed to further replies.

Hippokrates

Calculating the position of a file

Recommended Posts

Hippokrates    122
In my archive system I would like to know where a file is located within an archive. I can determine where it es when writing all the files to the archive. But this content is modified afterwards (compressed for example). So how can i possibly know where my file is after, for example, compressing my archive with zlib ?

Share this post


Link to post
Share on other sites
daerid    354
ummm... I''d say uncompress the file with zlib, and then just reverse the algorithm used to store it.

Other than that, make sure that the header of the archive file has a table of contents that contains the offset and length of each file in the archive.

And enforce that any modification to the contents of the archive must update the table of contents as well.

Share this post


Link to post
Share on other sites
Stoffel    250
You can''t. If it''s compressed, the information that used to be at byte 400 could be spread over several parts of the file after compression. Compressed files generally don''t have byte boundaries anyway--they''re usually bitstreams.

Share this post


Link to post
Share on other sites