Class Poco::Zip::ZipLocalFileHeader
Author: Applied Informatics Software Engineering GmbH and Contributors
Date: 2009-11-24

# 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, isDirectory, isEncrypted, isFile, lastModifiedAt, searchCRCAndSizesAfterData, setCRC, setCompressedSize, setFileName, setSearchCRCAndSizesAfterData, setStartPos, setUncompressedSize

## 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
);

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

## Destructor

### ~ZipLocalFileHeader

virtual ~ZipLocalFileHeader();

Destroys the ZipLocalFileHeader.

## Member Functions

### createHeader

std::string createHeader() const;

Creates a header

### getCRC

Poco::UInt32 getCRC() const;

### getCompressedSize

Poco::UInt32 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
);

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::UInt32 getUncompressedSize() const;

### hasData

bool hasData() const;

### hasExtraField

bool hasExtraField() const;

### isDirectory

bool isDirectory() const;

### isEncrypted

bool isEncrypted() const;

### isFile

bool isFile() const;

### lastModifiedAt

const Poco::DateTime & lastModifiedAt() const;

### searchCRCAndSizesAfterData

bool searchCRCAndSizesAfterData() const;

### setCRC

void setCRC(
Poco::UInt32 val
);

### setCompressedSize

void setCompressedSize(
Poco::UInt32 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::UInt32 val
);

## Variables

### HEADER

static const char HEADER[ZipCommon::HEADER_SIZE];