Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2007-11

streaming file from zip into my app

13 messages · 5 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Marc Santhoff

Hi,

I'd like to unzip one file from a zip archive and use it directly as input for something else (sax or self written parser).

Since the unzip package form the "extra" dir only writes to disc files:

Is there any alternative source for writing from zip to a stream instead of a file?

Or even better: is any fpc source for extracting the document info from Openoffice.org files already written? ;)

TIA,
Marc

Reply by email

Unknown author
to Marc Santhoff
Show quoted text 12 lines
Hi, I'd like to unzip one file from a zip archive and use it directly as input for something else (sax or self written parser). Since the unzip package form the "extra" dir only writes to disc files: Is there any alternative source for writing from zip to a stream instead of a file? Or even better: is any fpc source for extracting the document info from Openoffice.org files already written? ;)

Hi Marc,

You can have a look at TZipFile
(http://wiki.lazarus.freepascal.org/ZipFile). The only problem still with it is that it does not support decoding / encoding. But the basis is there already.
You can access a zipfile as if it's a filesystem.

Darius

Reply by email

Unknown author
to Marc Santhoff: I'd like to unzip one file from a zip archive and use it directly as input for something…
Show quoted text 12 lines
Hi, I'd like to unzip one file from a zip archive and use it directly as input for something else (sax or self written parser). Since the unzip package form the "extra" dir only writes to disc files: Is there any alternative source for writing from zip to a stream instead of a file? Or even better: is any fpc source for extracting the document info from Openoffice.org files already written? ;)

Hi Marc,

You can have a look at TZipFile
(http://wiki.lazarus.freepascal.org/ZipFile). The only problem still with it is that it does not support decoding / encoding. But the basis is there already.
You can access a zipfile as if it's a filesystem.

Darius

Reply by email

Graeme Geldenhuys
to Unknown author
Show quoted text 5 lines
You can have a look at TZipFile (http://wiki.lazarus.freepascal.org/ZipFile). The only problem still with it is that it does not support decoding / encoding. But the basis is there already. You can access a zipfile as if it's a filesystem.

Hi Darius,

I haven't forgotten about that component either... :-) We simply haven't reached that stage in our project yet. We will be using TZipFile for a custom compressed help format (something like OOo help) and for storing our teaching modules (a maths tutoring system).

I would also like to incorporate 7zip compression support with the existing ZLib compression. I found a Object Pascal implementation of 7zip the other day.

Regards,
- Graeme -

_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/

Reply by email

Marc Santhoff
to Unknown author: You can have a look at TZipFile (http://wiki.lazarus.freepascal.org/ZipFile). The only…

Am Freitag, den 30.11.2007, 09:04 +0100 schrieb

Show quoted text 19 lines
> Hi, > > I'd like to unzip one file from a zip archive and use it directly as > input for something else (sax or self written parser). > > Since the unzip package form the "extra" dir only writes to disc files: > > Is there any alternative source for writing from zip to a stream instead > of a file? > > Or even better: is any fpc source for extracting the document info from > Openoffice.org files already written? ;) Hi Marc, You can have a look at TZipFile (http://wiki.lazarus.freepascal.org/ZipFile). The only problem still with it is that it does not support decoding / encoding. But the basis is there already.

What de- and encoding is it, are you talking of character sets or encryption?

The target documents are unencrypted for sure, but they are written in different languages.

You can access a zipfile as if it's a filesystem.

That would be the right view, I'll have a look.

Thanks Darius,
Marc

Reply by email

Unknown author
to Marc Santhoff
What de- and encoding is it, are you talking of character sets or encryption?

I was referring to compression. It should be trivial to implement, but I never got around it. So if you have interest and want to patch it please do, I will apply it.

Darius

Reply by email

Marc Santhoff
to Unknown author

Am Freitag, den 30.11.2007, 16:21 +0100 schrieb

Show quoted text 6 lines
> What de- and encoding is it, are you talking of character sets or > encryption? I was referring to compression. It should be trivial to implement, but I never got around it. So if you have interest and want to patch it please do, I will apply it.

I'd like to, but that would clearly be far too much work for the small time frame I've got, sorry. But this time I'm lucky, the description file "meta.xml" in the root dir of OO.o docs is only stored (in opposite to "deflated").

But I still have questions about the code. Do I understand correctly that Graeme contributed the de-/compression code but it still has to get integrated and used by the component?

Thank you,
Marc

Reply by email

Graeme Geldenhuys
to Marc Santhoff
Marc Santhoff wrote
But I still have questions about the code. Do I understand correctly that Graeme contributed the de-/compression code but it still has to get integrated and used by the component?

We used the zlib (de)compression units from the tiOPF project. We simply removed the references to other tiOPF units - it was pretty stand-alone already so was easy. So yes, what's left is to integrate that code into the TZipFile component and do some tests. The (de)compression code has already been well unit tested in tiOPF, so we know that part works perfectly. As I stated earlier, I have also found a Object Pascal implementation of 7zip which I would like to add to both TZipFile and tiOPF - I still need to double check the licensing though.

Regards,
- Graeme -

_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/

Reply by email

Marc Santhoff
to Graeme Geldenhuys
Graeme Geldenhuys wrote 15 lines
On 30/11/2007, Marc Santhoff wrote: > > But I still have questions about the code. Do I understand correctly > that Graeme contributed the de-/compression code but it still has to get > integrated and used by the component? We used the zlib (de)compression units from the tiOPF project. We simply removed the references to other tiOPF units - it was pretty stand-alone already so was easy. So yes, what's left is to integrate that code into the TZipFile component and do some tests. The (de)compression code has already been well unit tested in tiOPF, so we know that part works perfectly. As I stated earlier, I have also found a Object Pascal implementation of 7zip which I would like to add to both TZipFile and tiOPF - I still need to double check the licensing though.

I'm remembering slowly, zlib is for handling gzip format, pkzip format is still missing. And 7zip, does it have it's own format or is this used for the common ".zip"-files?

If I would want to complete the component, I'd try to use and maybe add something to the unit I've already found in packages/extra/unzip. At least the compression routines should do.

Marc

Reply by email

Darius Blaszijk
to Marc Santhoff
Marc Santhoff wrote 24 lines
Am Freitag, den 30.11.2007, 23:09 +0200 schrieb Graeme Geldenhuys: > On 30/11/2007, Marc Santhoff wrote: > >> But I still have questions about the code. Do I understand correctly >> that Graeme contributed the de-/compression code but it still has to get >> integrated and used by the component? >> > We used the zlib (de)compression units from the tiOPF project. We > simply removed the references to other tiOPF units - it was pretty > stand-alone already so was easy. So yes, what's left is to integrate > that code into the TZipFile component and do some tests. The > (de)compression code has already been well unit tested in tiOPF, so we > know that part works perfectly. As I stated earlier, I have also > found a Object Pascal implementation of 7zip which I would like to add > to both TZipFile and tiOPF - I still need to double check the > licensing though. > I'm remembering slowly, zlib is for handling gzip format, pkzip format is still missing. And 7zip, does it have it's own format or is this used for the common ".zip"-files?

Both gzip and zip support DEFLATE compression. The main difference between the two is that gzip internally ias a solid archive and zip not. This enables the use of the zip format as a "filesystem" without requiring to inflate the entire archive.
7zip uses LZMA compression which is also supported by the zipfile format.

If I would want to complete the component, I'd try to use and maybe add something to the unit I've already found in packages/extra/unzip. At least the compression routines should do.

Wherever you will start it will boil down to implement the zlib compression / decompression (inflate / deflate) algorithms.

Darius

Show quoted text 9 lines
Marc _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply by email

Marco van de Voort
to Marc Santhoff: I'm remembering slowly, zlib is for handling gzip format, pkzip format is still missing.…
Show quoted text 24 lines
Am Freitag, den 30.11.2007, 23:09 +0200 schrieb Graeme Geldenhuys: > On 30/11/2007, Marc Santhoff wrote: > > > > But I still have questions about the code. Do I understand correctly > > that Graeme contributed the de-/compression code but it still has to get > > integrated and used by the component? > > We used the zlib (de)compression units from the tiOPF project. We > simply removed the references to other tiOPF units - it was pretty > stand-alone already so was easy. So yes, what's left is to integrate > that code into the TZipFile component and do some tests. The > (de)compression code has already been well unit tested in tiOPF, so we > know that part works perfectly. As I stated earlier, I have also > found a Object Pascal implementation of 7zip which I would like to add > to both TZipFile and tiOPF - I still need to double check the > licensing though. I'm remembering slowly, zlib is for handling gzip format, pkzip format is still missing. And 7zip, does it have it's own format or is this used for the common ".zip"-files? If I would want to complete the component, I'd try to use and maybe add something to the unit I've already found in packages/extra/unzip. At least the compression routines should do.

Note if sb works on zlib, there still is a bugreport about OOo files and zlib in mantis (mismatch in CRC). I tried to fix it, but got stuck

Reply by email

Marc Santhoff
to Marco van de Voort: Note if sb works on zlib, there still is a bugreport about OOo files and zlib in mantis…
Marco van de Voort wrote 27 lines
> Am Freitag, den 30.11.2007, 23:09 +0200 schrieb Graeme Geldenhuys: > > On 30/11/2007, Marc Santhoff wrote: > > > > > > But I still have questions about the code. Do I understand correctly > > > that Graeme contributed the de-/compression code but it still has to get > > > integrated and used by the component? > > > > We used the zlib (de)compression units from the tiOPF project. We > > simply removed the references to other tiOPF units - it was pretty > > stand-alone already so was easy. So yes, what's left is to integrate > > that code into the TZipFile component and do some tests. The > > (de)compression code has already been well unit tested in tiOPF, so we > > know that part works perfectly. As I stated earlier, I have also > > found a Object Pascal implementation of 7zip which I would like to add > > to both TZipFile and tiOPF - I still need to double check the > > licensing though. > > I'm remembering slowly, zlib is for handling gzip format, pkzip format > is still missing. And 7zip, does it have it's own format or is this used > for the common ".zip"-files? > > If I would want to complete the component, I'd try to use and maybe add > something to the unit I've already found in packages/extra/unzip. At > least the compression routines should do. Note if sb works on zlib, there still is a bugreport about OOo files and zlib in mantis (mismatch in CRC). I tried to fix it, but got stuck

I'm not, I only will start to write some code for extracting the non-compressed "meta.xml" from OOo-files for accessing (r/o currently) the document information. I need this for making a catalogue of files.

If I start something in the compression area I'll ask beforehand.

Thank for the warning,
Marc

Reply by email