org.at4j.zip.ef
Class NewInfoZipUnixExtraField

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

public class NewInfoZipUnixExtraField
extends Object
implements ZipEntryExtraField

This, the "Unix2" Zip entry extra field, contains information on the owner UID/GID of the Zip entry.

The local header version contains UID/GID information. The central header version is empty.

Since:
1.0
Author:
Karl Gustafsson
See Also:
NewInfoZipUnixExtraFieldFactory, InfoZipUnixExtraField

Field Summary
static NewInfoZipUnixExtraField CENTRAL_HEADER_VERSION
          This is the central header version of this extra field.
static UnsignedShort CODE
           
 
Constructor Summary
NewInfoZipUnixExtraField(UnsignedShort uid, UnsignedShort gid)
          This creates the local header version of this extra field.
 
Method Summary
 byte[] encode(ZipBuilderConfiguration builder)
          Encode this extra field's data for storing in a Zip file.
 boolean equals(Object o)
           
 UnsignedShort getGid()
          Get the owner group id for the Zip entry.
 UnsignedShort getUid()
          Get the owner user id for the Zip entry.
 int hashCode()
           
 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, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

CODE

public static final UnsignedShort CODE

CENTRAL_HEADER_VERSION

public static final NewInfoZipUnixExtraField CENTRAL_HEADER_VERSION
This is the central header version of this extra field. It does not contain any information.

Constructor Detail

NewInfoZipUnixExtraField

public NewInfoZipUnixExtraField(UnsignedShort uid,
                                UnsignedShort gid)
This creates the local header version of this extra field.

Parameters:
uid - The owner user id.
gid - The owner group id.
Method Detail

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.

getUid

public UnsignedShort getUid()
Get the owner user id for the Zip entry.

Returns:
The owner user id, or null if this is the central header version of this object.

getGid

public UnsignedShort getGid()
Get the owner group id for the Zip entry.

Returns:
The owner group id, or null if this is the central header version of this object.

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

equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object