[ENH] Zip Serial Reading (was Re: [NIT] Managing repositories in MC)

Ned Konz ned at bike-nomad.com
Mon Sep 22 00:03:23 UTC 2003


On Sunday 21 September 2003 03:08 pm, Avi Bryant wrote:
> On Sun, 21 Sep 2003, Ned Konz wrote:
> > If you store the version info as the first member of the zip
> > (either compressed or not) you can just grab the first packet's
> > worth of bytes (1K or so). You will get the member header
> > preceding it, which you can examine to make sure you have all the
> > bytes.
>
> Thanks, Ned.  I seem to be able to get the first member from a zip
> file by doing this:
>
> n := 'Foo.mcz'.
> f := FileStream readOnlyFileNamed: n.
> f binary.
> z := ZipArchiveMember newFromZipFile: f named: n.
> z readLocalDirectoryFileHeaderFrom: f.
> z contents.
>
> Unfortunately, the very first member of a .mcz file is the package
> name, not the ancestry info.

So why not store the version first?

> Is there anything about the zip format that would prevent an
> interface like the code below, without needing the central
> directory?
>
> z := ZipArchiveStream on: aStream.
> aMember = z nextMember.
> anotherMember = z nextMember.
> ....

No, that should work, assuming that the zip was stored correctly. All 
the data is there in the headers, which precede the members 
(usually).

Enclosed is a CS that will add serial reading support (header by 
header) to the existing ZipArchive stuff.

It hasn't been tested, and I couldn't find any support for the HTTP 
byte-ranges in the image.

-- 
Ned Konz
http://bike-nomad.com
GPG key ID: BEEA7EFE
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ZipSerialReading-nk.1.cs.gz
Type: text/x-squeak-changeset
Size: 1385 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20030921/fcc749d6/ZipSerialReading-nk.1.cs.bin


More information about the Squeak-dev mailing list