Built-in ZIP handler (not a .NET solution)

Status
Not open for further replies.
C

CMI

Guest
For years I wanted the 4GL/ABL language to be able to handle ZIP files. The ability to create and read ZIP files has always been a drag as file(s) had to be written to disk for processing and using 3rd party executables. I want my code to be platform independent. Example of how I would use it. Currently I receive files XML file packaged up in a ZIP file. I have call a 3rd party executable to extract the a XML(s) files to disk. I the use the built-in SAX-reader to import the XML. I then write my own XML document, again this time using the SAX-Writer and package it back into the original ZIP file using a zip command. Use the ZIP handle to extract the XML files into a memptr. Then used the SAX-reader/SAX-writer to then write back into the ZIP file and all of this could be done with memptrs. Simpler and faster. Here is a quick mockup spec. how I would envisage the zip handle object would be defined. I would not say it was perfect but it gives you an indication on how it would be used. Feel free to add what other related features you think would be needed. CREATE ZIP-PACKAGE handle [ NO-ERROR ] . Return type: LOGICAL hnZip:Compression( compression-level ) Return type: LOGICAL SET-OUTPUT-DESTINATION(mode, {FILE|STREAM|STREAM-HANDLE|MEMPTR} ) Return type: LOGICAL SET-INPUT-SOURCE(mode, {FILE|STREAM|STREAM-HANDLE|MEMPTR} ) Return type: LOGICAL Open-package() Return type: LOGICAL Close-package() Return type: LOGICAL add-file(FILENAME, mode, {FILE|MEMPTR|LONGCHAR} ) Return type: LOGICAL add-Empty-Dir(dir-name) Return type: LOGICAL delete-file(FILENAME). Return type: MEMPTR GET-FILE(FILENAME) Return type: LONGCHAR AS comma separated STRING (or even a JSON array/object if you are feeling fruity). list-files(?| dir-path, [RECURSIVE]). Also not everybody is using .NET so .NET is not the answer to everything.

Continue reading...
 
Status
Not open for further replies.
Top