org.at4j.zip.ef
Interface ZipEntryExtraField

All Known Implementing Classes:
ExtendedTimestampExtraField, InfoZipUnixExtraField, NewInfoZipUnixExtraField, NtfsExtraField, UnicodeCommentExtraField, UnicodePathExtraField, UnparsedZipEntryExtraField

public interface ZipEntryExtraField

This interface defines a Zip entry extra field. A Zip entry may have zero or more extra fields that store metadata that is not supported in the regular headers or the in the external file attributes.

An extra field for an entry is always stored in two variants – one in the local file header and one in the entry's central directory record. The local header version often contain more data than the central directory version.

Each extra field type is identified with a unique code.

Since:
1.0
Author:
Karl Gustafsson

Method Summary
 byte[] encode(ZipBuilderConfiguration c)
          Encode this extra field's data for storing in a Zip file.
 boolean isInLocalHeader()
          Is this field stored in the Zip entry's local header or in the Zip file's central directory record?
 

Method Detail

isInLocalHeader

boolean isInLocalHeader()
Is this field stored in the Zip entry's local header or in the Zip file's central directory record?

The same ZipEntryExtraField type may have different properties depending on if it is specified in the local or in the central header.

Returns:
true if this extra field comes from the Zip entry's local header. false if it comes from the Zip file's central directory.

encode

byte[] encode(ZipBuilderConfiguration c)
Encode this extra field's data for storing in a Zip file. This is used when building Zip files.

Parameters:
c - The configuration for the Zip builder object that is building the Zip file.
Returns:
A byte array containing the extra field data as it should be stored in the Zip file. The returned array should not contain the initial four bytes with the extra field code and the extra field length.