ZipLocalFileRecord
Previous  Top  Next

ZipLocalFileRecord - The Local File Record of a Zip File Entry.

Description

Each Zip File Entry consists of a Local File Record followed by the compressed or stored Data. This Local File Record does not contain any File Attribute information nor File Comments, but otherwise contains all the information to recreate the (File) Entry. It is basically a subset of the corresponding Central Directory Record, which is located at the end of the Zip File, in the Central Directory.  
 
This Local File Record is represented as a Structure in the XbZLib implementation. The following is the format of the Local File Record, as defined in the file "XbZLibSt.prg":  

STRUCTURE ZipLocalFileRecord  
  CHAR  Signature       SIZE 4  // "PK" + chr(3) + chr(4)  
  UINT  VerToExtract            // Set to 2.0 - DOS, Windows, OS/2 (FAT/VFAT/NTFS)  
  UINT  GPFlag                  // Set to "0" (Currently IGNORED)  
  UINT  CompMethod              // Only "0" (Stored) and "8" (Deflated) are supported  
  CHAR  FileTime        SIZE 4  
  CHAR  CRC             SIZE 4  
  ULONG CompSize  
  ULONG UnCompSize  
  UINT  FNameLen  
  UINT  ExtraFldLen             // Set to "0" (Currently IGNORED)  
  CHAR  FileName  
  CHAR  ExtraFld                // Set to "" (Currently IGNORED)  
ENDSTRUCT  

The Version-To-Extract Flag is currently ignored when read and always set to 2.0 DOS/Windows when written, and the General Purpose Flag and the Extra Field are completely ignored, all of which could create compatibility problems with other Operating Systems and even other Windows/DOS Zip Programs and Zip Files created or updated by such programs. A future version of XbZLib might be able to handle those Flags correctly, though.

Example

The following Example code creates an empty Local File Record object and sets some values:  

LOCAL oLFRec := ZipLocalFileRecord():New()  
oLFRec:Signature := XBZ_LOCAL_FILE_RECORD  
oLFRec:FileName  := "SomeFileName"  
oLFRec:FNameLen  := len(oLFRec:FileName)