Calculating the position of a file
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 ?
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.
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.
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.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement