org.at4j.zip.ef
Class UnparsedZipEntryExtraField

java.lang.Object
  extended by org.at4j.zip.ef.UnparsedZipEntryExtraField
All Implemented Interfaces:
ZipEntryExtraField

public class UnparsedZipEntryExtraField
extends Object
implements ZipEntryExtraField

This extra field object is used when the Zip file parser encounters an extra field type that is not supported. This object contains the unparsed extra field data.

Since:
1.0
Author:
Karl Gustafsson

Constructor Summary
UnparsedZipEntryExtraField(byte[] data, boolean inLocalHeader)
          Create a new unparsed extra field object.
 
Method Summary
 byte[] encode(ZipBuilderConfiguration builder)
          Encode this extra field's data for storing in a Zip file.
 byte[] getData()
          Get the unparsed data for this extra field.
 boolean isInLocalHeader()
          Is this field stored in the Zip entry's local header or in the Zip file's central directory record?
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

UnparsedZipEntryExtraField

public UnparsedZipEntryExtraField(byte[] data,
                                  boolean inLocalHeader)
Create a new unparsed extra field object.

Parameters:
data - The unparsed data.
inLocalHeader - Is this field in the Zip entry's local header or in the Zip file's central directory.
Method Detail

getData

public byte[] getData()
Get the unparsed data for this extra field.

Returns:
A copy of this extra field's data.

isInLocalHeader

public boolean isInLocalHeader()
Description copied from interface: ZipEntryExtraField
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.

Specified by:
isInLocalHeader in interface ZipEntryExtraField
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

public byte[] encode(ZipBuilderConfiguration builder)
Description copied from interface: ZipEntryExtraField
Encode this extra field's data for storing in a Zip file. This is used when building Zip files.

Specified by:
encode in interface ZipEntryExtraField
Parameters:
builder - 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.

toString

public String toString()
Overrides:
toString in class Object