org.at4j.zip.ef
Class InfoZipUnixExtraField

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

public class InfoZipUnixExtraField
extends Object
implements ZipEntryExtraField

This is the older InfoZip Unix extra field. The central header version contains the last access and modification times. The local header version contains that and information on the file owner UID and GID.

Since:
1.0
Author:
Karl Gustafsson
See Also:
InfoZipUnixExtraFieldFactory, NewInfoZipUnixExtraField

Field Summary
static UnsignedShort CODE
           
 
Constructor Summary
InfoZipUnixExtraField(Date lastAccessTime, Date lastModificationTime)
          Create a central header version of this object.
InfoZipUnixExtraField(Date lastAccessTime, Date lastModificationTime, UnsignedShort uid, UnsignedShort gid)
          Create a local header version of this object.
 
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.
 Date getLastAccessTime()
          Get the Zip entry's last access time.
 Date getLastModificationTime()
          Get the Zip entry's last modification time.
 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
Constructor Detail

InfoZipUnixExtraField

public InfoZipUnixExtraField(Date lastAccessTime,
                             Date lastModificationTime)
Create a central header version of this object.

Parameters:
lastAccessTime - The Zip entry's last access time.
lastModificationTime - The Zip entry's last modification time.

InfoZipUnixExtraField

public InfoZipUnixExtraField(Date lastAccessTime,
                             Date lastModificationTime,
                             UnsignedShort uid,
                             UnsignedShort gid)
Create a local header version of this object.

Parameters:
lastAccessTime - The Zip entry's last access time.
lastModificationTime - The Zip entry's last modification time.
uid - The Zip entry's owner's user id.
gid - The Zip entry's owner's 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.

getLastAccessTime

public Date getLastAccessTime()
Get the Zip entry's last access time.

Returns:
The Zip entry's last access time.

getLastModificationTime

public Date getLastModificationTime()
Get the Zip entry's last modification time.

Returns:
The Zip entry's last modification time.

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

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.