org.at4j.zip.ef
Class NtfsExtraField

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

public class NtfsExtraField
extends Object
implements ZipEntryExtraField

This is the PKWare NTFS extra field. It contains information on the creation, last access and last modification times of the entity.

Since:
1.0
Author:
Karl Gustafsson
See Also:
NtfsExtraFieldFactory

Field Summary
static UnsignedShort CODE
           
 
Constructor Summary
NtfsExtraField(boolean inLocalHeader, WinNtTime lastModificationTime, WinNtTime lastAccessTime, WinNtTime creationTime)
          Create a new NTFS extra field.
 
Method Summary
 byte[] encode(ZipBuilderConfiguration builder)
          Encode this extra field's data for storing in a Zip file.
 boolean equals(Object o)
           
 WinNtTime getCreationTime()
          Get the time that the entity in the Zip entry was created.
 WinNtTime getLastAccessTime()
          Get the time when the entity in the Zip entry was last accessed.
 WinNtTime getLastModified()
          Get the time that the entity in the Zip entry was last modified.
 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

NtfsExtraField

public NtfsExtraField(boolean inLocalHeader,
                      WinNtTime lastModificationTime,
                      WinNtTime lastAccessTime,
                      WinNtTime creationTime)
Create a new NTFS extra field.

Parameters:
inLocalHeader - Is the extra field in the Zip entry's local header or in the Zip file's central directory.
lastModificationTime - The last modification time for the file system entity that was used to create the Zip entry.
lastAccessTime - The last access time for the file system entity that was used to create the Zip entry.
creationTime - The creation time for the file system entity that was used to create the Zip entry.
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.

getLastModified

public WinNtTime getLastModified()
Get the time that the entity in the Zip entry was last modified.

Returns:
The last modification time.

getCreationTime

public WinNtTime getCreationTime()
Get the time that the entity in the Zip entry was created.

Returns:
The creation time.

getLastAccessTime

public WinNtTime getLastAccessTime()
Get the time when the entity in the Zip entry was last accessed.

Returns:
The last access time.

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.

equals

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

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object