Zip

## Zip Zip — |

## Synopsis

                GsfInfileZip;
    GsfInfile*  gsf_infile_zip_new              (GsfInput *source,
                                                 GError **err);
                GsfOutfileZip;
    GsfOutfile* gsf_outfile_zip_new             (GsfOutput *sink,
                                                 GError **err);
    gboolean    gsf_outfile_zip_set_compression_method
                                                (GsfOutfileZip *zip,
                                                 GsfZipCompressionMethod method);

                GsfZipDirent;
    GsfZipDirent* gsf_zip_dirent_new            (void);
    void        gsf_zip_dirent_free             (GsfZipDirent *dirent);
                GsfZipVDir;
    void        gsf_vdir_free                   (GsfZipVDir *vdir,
                                                 gboolean free_dirent);
    GsfZipVDir* gsf_vdir_new                    (char const *name,
                                                 gboolean is_directory,
                                                 GsfZipDirent *dirent);
    void        gsf_vdir_add_child              (GsfZipVDir *vdir,
                                                 GsfZipVDir *child);
    #define     ZIP_DIRENT_USIZE
    #define     ZIP_DIRENT_OFFSET
    enum        GsfZipCompressionMethod;
    #define     ZIP_FILE_HEADER_NAME_SIZE
    #define     ZZIP_IS_STREAMED                (p)
    #define     ZIP_FILE_HEADER_EXTRACT
    #define     ZIP_TRAILER_SIZE
    #define     ZIP_HEADER_TIME
    #define     ZIP_FILE_HEADER_SIZE
    #define     ZZIP_IS_ENCRYPTED               (p)
    #define     ZIP_HEADER_VERSION
    #define     ZIP_BUF_SIZE
    #define     ZIP_DIRENT_CRC32
    #define     ZIP_HEADER_COMP_SIZE
    #define     ZIP_DIRENT_COMPR_METHOD
    #define     ZIP_DIRENT_FILE_TYPE
    #define     ZIP_FILE_HEADER_EXTRAS_SIZE
    #define     ZIP_DIRENT_EXTRACT
    #define     ZIP_DIRENT_FILE_MODE
    #define     ZIP_DIRENT_FLAGS
    #define     ZIP_FILE_HEADER_CSIZE
    #define     ZIP_TRAILER_DIR_SIZE
    #define     ZIP_TRAILER_COMMENT_SIZE
    #define     ZIP_TRAILER_ENTRIES
    #define     ZIP_NAME_SEPARATOR
    #define     ZIP_HEADER_SIZE
    #define     ZIP_HEADER_CRC
    #define     ZIP_FILE_HEADER_FLAGS
    #define     ZIP_DIRENT_EXTRAS_SIZE
    #define     ZIP_HEADER_COMP_METHOD
    #define     ZZIP_IS_COMPRLEVEL              (p)
    #define     ZIP_DIRENT_DOSTIME
    #define     ZIP_DIRENT_ENCODER
    #define     ZIP_HEADER_OS
    #define     ZIP_DIRENT_COMMENT_SIZE
    #define     ZIP_FILE_HEADER_CRC32
    #define     ZIP_HEADER_FLAGS
    #define     ZIP_TRAILER_DISK
    #define     ZIP_FILE_HEADER_USIZE
    #define     ZIP_TRAILER_TOTAL_ENTRIES
    #define     ZIP_HEADER_NAME_LEN
    #define     ZIP_HEADER_UNCOMP_SIZE
    #define     ZIP_TRAILER_DIR_DISK
    #define     ZIP_DIRENT_CSIZE
    #define     ZIP_TRAILER_DIR_POS
    #define     ZIP_BLOCK_SIZE
    #define     ZIP_DIRENT_NAME_SIZE
    #define     ZIP_DIRENT_SIZE
    #define     ZIP_DIRENT_DISKSTART
    #define     ZIP_HEADER_EXTRA_LEN
    #define     ZIP_FILE_HEADER_COMPR_METHOD
    #define     ZIP_FILE_HEADER_DOSTIME

## Object Hierarchy

      GObject
       +----GsfInput
             +----GsfInfile
                   +----GsfInfileZip

      GObject
       +----GsfOutput
             +----GsfOutfile
                   +----GsfOutfileZip

## Properties

      "compression-level"    gint                  : Read
      "internal-parent"      GsfInfileZip          : Write / Construct Only
      "source"               GsfInput              : Read / Write / Construct Only
      "compression-level"    gint                  : Read / Write / Construct Only
      "entry-name"           gchararray            : Read / Write / Construct Only
      "sink"                 GsfOutput             : Read / Write / Construct Only

## Description

## Details

### GsfInfileZip

    typedef struct _GsfInfileZip GsfInfileZip;

### gsf_infile_zip_new ()

    GsfInfile*  gsf_infile_zip_new              (GsfInput *source,
                                                 GError **err);

Opens the root directory of a Zip file. NOTE : adds a reference to `source`

`source` : | A base GsfInput
`err` : | A GError, optionally `null`
Returns : | : the new zip file handler

### GsfOutfileZip

    typedef struct _GsfOutfileZip GsfOutfileZip;

### gsf_outfile_zip_new ()

    GsfOutfile* gsf_outfile_zip_new             (GsfOutput *sink,
                                                 GError **err);

Creates the root directory of a Zip file and manages the addition of children.

NOTE : adds a reference to `sink`

`sink` : |
`err` : |
Returns : | : the new zip file handler

### gsf_outfile_zip_set_compression_method ()

    gboolean    gsf_outfile_zip_set_compression_method
                                                (GsfOutfileZip *zip,
                                                 GsfZipCompressionMethod method);

`zip` : |
`method` : |
Returns : |

### GsfZipDirent

    typedef struct {
    	char                    *name;
    	GsfZipCompressionMethod  compr_method;
    	guint32                  crc32;
    	size_t                   csize;
    	size_t                   usize;
    	gsf_off_t                offset;
    	gsf_off_t                data_offset;
    	guint32                  dostime;
    } GsfZipDirent;

### gsf_zip_dirent_new ()

    GsfZipDirent* gsf_zip_dirent_new            (void);

Returns : |

### gsf_zip_dirent_free ()

    void        gsf_zip_dirent_free             (GsfZipDirent *dirent);

`dirent` : |

### GsfZipVDir

    typedef struct {
    	char *name;
    	gboolean is_directory;
    	GsfZipDirent *dirent;
    	GSList *children, *last_child;
    } GsfZipVDir;

### gsf_vdir_free ()

    void        gsf_vdir_free                   (GsfZipVDir *vdir,
                                                 gboolean free_dirent);

`vdir` : |
`free_dirent` : |

### gsf_vdir_new ()

    GsfZipVDir* gsf_vdir_new                    (char const *name,
                                                 gboolean is_directory,
                                                 GsfZipDirent *dirent);

`name` : |
`is_directory` : |
`dirent` : |
Returns : |

### gsf_vdir_add_child ()

    void        gsf_vdir_add_child              (GsfZipVDir *vdir,
                                                 GsfZipVDir *child);

`vdir` : |
`child` : |

### ZIP_DIRENT_USIZE

    #define ZIP_DIRENT_USIZE                24

### ZIP_DIRENT_OFFSET

    #define ZIP_DIRENT_OFFSET               42

### enum GsfZipCompressionMethod

    typedef enum {
    	GSF_ZIP_STORED =          0,		/* supported for export */
    	GSF_ZIP_SHRUNK =          1,
    	GSF_ZIP_REDUCEDx1 =       2,
    	GSF_ZIP_REDUCEDx2 =       3,
    	GSF_ZIP_REDUCEDx3 =       4,
    	GSF_ZIP_REDUCEDx4 =       5,
    	GSF_ZIP_IMPLODED  =       6,
    	GSF_ZIP_TOKENIZED =       7,
    	GSF_ZIP_DEFLATED =        8,		/* supported for export */
    	GSF_ZIP_DEFLATED_BETTER = 9,
    	GSF_ZIP_IMPLODED_BETTER = 10
    } GsfZipCompressionMethod;

### ZIP_FILE_HEADER_NAME_SIZE

    #define ZIP_FILE_HEADER_NAME_SIZE       26

### ZZIP_IS_STREAMED()

    #define ZZIP_IS_STREAMED(p)    (((*(unsigned char*)p)>>3)&1)

`p` : |

### ZIP_FILE_HEADER_EXTRACT

    #define ZIP_FILE_HEADER_EXTRACT          4

### ZIP_TRAILER_SIZE

    #define ZIP_TRAILER_SIZE 		22

### ZIP_HEADER_TIME

    #define ZIP_HEADER_TIME                 10

### ZIP_FILE_HEADER_SIZE

    #define ZIP_FILE_HEADER_SIZE            30

### ZZIP_IS_ENCRYPTED()

    #define ZZIP_IS_ENCRYPTED(p)    ((*(unsigned char*)p)&1)

`p` : |

### ZIP_HEADER_VERSION

    #define ZIP_HEADER_VERSION 		 4

### ZIP_BUF_SIZE

    #define ZIP_BUF_SIZE 512

### ZIP_DIRENT_CRC32

    #define ZIP_DIRENT_CRC32                16

### ZIP_HEADER_COMP_SIZE

    #define ZIP_HEADER_COMP_SIZE		18

### ZIP_DIRENT_COMPR_METHOD

    #define ZIP_DIRENT_COMPR_METHOD         10

### ZIP_DIRENT_FILE_TYPE

    #define ZIP_DIRENT_FILE_TYPE            36

### ZIP_FILE_HEADER_EXTRAS_SIZE

    #define ZIP_FILE_HEADER_EXTRAS_SIZE     28

### ZIP_DIRENT_EXTRACT

    #define ZIP_DIRENT_EXTRACT              6

### ZIP_DIRENT_FILE_MODE

    #define ZIP_DIRENT_FILE_MODE            38

### ZIP_DIRENT_FLAGS

    #define ZIP_DIRENT_FLAGS                8

### ZIP_FILE_HEADER_CSIZE

    #define ZIP_FILE_HEADER_CSIZE           18

### ZIP_TRAILER_DIR_SIZE

    #define ZIP_TRAILER_DIR_SIZE 		12

### ZIP_TRAILER_COMMENT_SIZE

    #define ZIP_TRAILER_COMMENT_SIZE	20

### ZIP_TRAILER_ENTRIES

    #define ZIP_TRAILER_ENTRIES 		8

### ZIP_NAME_SEPARATOR

    #define ZIP_NAME_SEPARATOR    '/'

### ZIP_HEADER_SIZE

    #define ZIP_HEADER_SIZE 		30

### ZIP_HEADER_CRC

    #define ZIP_HEADER_CRC 			14

### ZIP_FILE_HEADER_FLAGS

    #define ZIP_FILE_HEADER_FLAGS            6

### ZIP_DIRENT_EXTRAS_SIZE

    #define ZIP_DIRENT_EXTRAS_SIZE          30

### ZIP_HEADER_COMP_METHOD

    #define ZIP_HEADER_COMP_METHOD           8

### ZZIP_IS_COMPRLEVEL()

    #define ZZIP_IS_COMPRLEVEL(p)  (((*(unsigned char*)p)>>1)&3)

`p` : |

### ZIP_DIRENT_DOSTIME

    #define ZIP_DIRENT_DOSTIME              12

### ZIP_DIRENT_ENCODER

    #define ZIP_DIRENT_ENCODER              4

### ZIP_HEADER_OS

    #define ZIP_HEADER_OS	 		 5

### ZIP_DIRENT_COMMENT_SIZE

    #define ZIP_DIRENT_COMMENT_SIZE         32

### ZIP_FILE_HEADER_CRC32

    #define ZIP_FILE_HEADER_CRC32           14

### ZIP_HEADER_FLAGS

    #define ZIP_HEADER_FLAGS 	         6

### ZIP_TRAILER_DISK

    #define ZIP_TRAILER_DISK 		4

### ZIP_FILE_HEADER_USIZE

    #define ZIP_FILE_HEADER_USIZE           22

### ZIP_TRAILER_TOTAL_ENTRIES

    #define ZIP_TRAILER_TOTAL_ENTRIES 	10

### ZIP_HEADER_NAME_LEN

    #define ZIP_HEADER_NAME_LEN		26

### ZIP_HEADER_UNCOMP_SIZE

    #define ZIP_HEADER_UNCOMP_SIZE          22

### ZIP_TRAILER_DIR_DISK

    #define ZIP_TRAILER_DIR_DISK 		6

### ZIP_DIRENT_CSIZE

    #define ZIP_DIRENT_CSIZE                20

### ZIP_TRAILER_DIR_POS

    #define ZIP_TRAILER_DIR_POS 		16

### ZIP_BLOCK_SIZE

    #define ZIP_BLOCK_SIZE 32768

### ZIP_DIRENT_NAME_SIZE

    #define ZIP_DIRENT_NAME_SIZE            28

### ZIP_DIRENT_SIZE

    #define ZIP_DIRENT_SIZE                 46

### ZIP_DIRENT_DISKSTART

    #define ZIP_DIRENT_DISKSTART            34

### ZIP_HEADER_EXTRA_LEN

    #define ZIP_HEADER_EXTRA_LEN		28

### ZIP_FILE_HEADER_COMPR_METHOD

    #define ZIP_FILE_HEADER_COMPR_METHOD     8

### ZIP_FILE_HEADER_DOSTIME

    #define ZIP_FILE_HEADER_DOSTIME         10

## Properties

### The "`compression-level`" property

      "compression-level"    gint                  : Read

The level of compression used, zero meaning none.

Allowed values: [0,10]

Default value: 0

### The "`internal-parent`" property

      "internal-parent"      GsfInfileZip          : Write / Construct Only

Internal use only.

### The "`source`" property

      "source"               GsfInput              : Read / Write / Construct Only

The archive being interpreted.

### The "`compression-level`" property

      "compression-level"    gint                  : Read / Write / Construct Only

The level of compression used, zero meaning none.

Allowed values: [0,10]

Default value: 8

### The "`entry-name`" property

      "entry-name"           gchararray            : Read / Write / Construct Only

The filename of this member in the archive without path.

Default value: NULL

### The "`sink`" property

      "sink"                 GsfOutput             : Read / Write / Construct Only

Where the archive is written.