# Poco::Zip

# class ZipLocalFileHeader

Library: Zip
Package: Zip
Header: Poco/Zip/ZipLocalFileHeader.h

## Description

Stores a Zip local file header

## Member Summary

Member Functions: createHeader, getCRC, getCompressedSize, getCompressionLevel, getCompressionMethod, getDataEndPos, getDataStartPos, getEndPos, getExtraField, getFileName, getHeaderSize, getHostSystem, getMajorVersionNumber, getMinorVersionNumber, getRequiredVersion, getStartPos, getUncompressedSize, hasData, hasExtraField, hasSupportedCompressionMethod, isDirectory, isEncrypted, isFile, lastModifiedAt, needsZip64, searchCRCAndSizesAfterData, setCRC, setCompressedSize, setFileName, setSearchCRCAndSizesAfterData, setStartPos, setUncompressedSize, setZip64Data

## Constructors

### ZipLocalFileHeader

ZipLocalFileHeader(
std::istream & inp,
bool assumeHeaderRead,
ParseCallback & callback
);

Creates the ZipLocalFileHeader by parsing the input stream. If assumeHeaderRead is true we assume that the first 4 bytes were already read outside. If skipOverDataBlock is true we position the stream after the data block (either at the next FileHeader or the Directory Entry)

### ZipLocalFileHeader

ZipLocalFileHeader(
const Poco::Path & fileName,
const Poco::DateTime & lastModifiedAt,
ZipCommon::CompressionMethod cm,
ZipCommon::CompressionLevel cl,
bool forceZip64 = false
);

Creates a zip file header from an absoluteFile. fileName is the name of the file in the zip, outputIsSeekable determines if we write CRC and file sizes to the LocalFileHeader or after data compression into a ZipDataInfo If forceZip64 is set true then the file header is allocated with zip64 extension.

## Destructor

### ~ZipLocalFileHeader

virtual ~ZipLocalFileHeader();

Destroys the ZipLocalFileHeader.

## Member Functions

### createHeader

std::string createHeader() const;

Creates a header

### getCRC

Poco::UInt32 getCRC() const;

### getCompressedSize

Poco::UInt64 getCompressedSize() const;

### getCompressionLevel

ZipCommon::CompressionLevel getCompressionLevel() const;

Returns the compression level used. Only valid when the compression method is CM_DEFLATE

### getCompressionMethod

ZipCommon::CompressionMethod getCompressionMethod() const;

### getDataEndPos

std::streamoff getDataEndPos() const;

### getDataStartPos

std::streamoff getDataStartPos() const;

Returns the streamoffset for the very first byte of data. Will be equal to DataEndPos if no data present

### getEndPos

std::streamoff getEndPos() const;

Points past the last byte of the file entry (ie. either the first byte of the next header, or the directory)

### getExtraField

const std::string & getExtraField() const;

### getFileName

const std::string & getFileName() const;

### getHeaderSize

Poco::UInt32 getHeaderSize() const;

Returns the total size of the header including filename + extra field size

### getHostSystem

ZipCommon::HostSystem getHostSystem() const;

### getMajorVersionNumber

int getMajorVersionNumber() const;

### getMinorVersionNumber

int getMinorVersionNumber() const;

### getRequiredVersion

void getRequiredVersion(
int & major,
int & minor
) const;

The minimum version required to extract the data

### getStartPos

std::streamoff getStartPos() const;

Returns the position of the first byte of the header in the file stream

### getUncompressedSize

Poco::UInt64 getUncompressedSize() const;

### hasData

bool hasData() const;

### hasExtraField

bool hasExtraField() const;

### hasSupportedCompressionMethod

bool hasSupportedCompressionMethod() const;

### isDirectory

bool isDirectory() const;

### isEncrypted

bool isEncrypted() const;

### isFile

bool isFile() const;

### lastModifiedAt

const Poco::DateTime & lastModifiedAt() const;

### needsZip64

bool needsZip64() const;

### searchCRCAndSizesAfterData

bool searchCRCAndSizesAfterData() const;

### setCRC

void setCRC(
Poco::UInt32 val
);

### setCompressedSize

void setCompressedSize(
Poco::UInt64 val
);

### setFileName

void setFileName(
const std::string & fileName,
bool isDirectory
);

### setSearchCRCAndSizesAfterData

void setSearchCRCAndSizesAfterData(
bool val
);

### setStartPos

void setStartPos(
std::streamoff start
);

Sets the start position to start and the end position to start+compressedSize

### setUncompressedSize

void setUncompressedSize(
Poco::UInt64 val
);

### setZip64Data

void setZip64Data();

## Variables

### HEADER

static const char HEADER[ZipCommon::HEADER_SIZE];