Top Description Fields Constructors Methods
org.apache.commons.compress.archivers.zip

public Class X000A_NTFS

extends Object
implements ZipExtraField
Class Inheritance
All Implemented Interfaces
org.apache.commons.compress.archivers.zip.ZipExtraField
Imports
java.nio.file.attribute.FileTime, java.util.Date, .Objects, java.util.zip.ZipException, org.apache.commons.io.file.attribute.FileTimes

NTFS extra field that was thought to store various attributes but in reality only stores timestamps.
   4.5.5 -NTFS Extra Field (0x000a):

      The following is the layout of the NTFS attributes
      "extra" block. (Note: At this time the Mtime, Atime
      and Ctime values MAY be used on any WIN32 system.)

Note

all fields stored in Intel low-byte/high-byte order. Value Size Description ----- ---- ----------- (NTFS) 0x000a 2 bytes Tag for this "extra" block type TSize 2 bytes Size of the total "extra" block Reserved 4 bytes Reserved for future use Tag1 2 bytes NTFS attribute tag value #1 Size1 2 bytes Size of attribute #1, in bytes (var) Size1 Attribute #1 data . . . TagN 2 bytes NTFS attribute tag value #N SizeN 2 bytes Size of attribute #N, in bytes (var) SizeN Attribute #N data For NTFS, values for Tag1 through TagN are as follows: (currently only one set of attributes is defined for NTFS) Tag Size Description ----- ---- ----------- 0x0001 2 bytes Tag for attribute #1 Size1 2 bytes Size of attribute #1, in bytes Mtime 8 bytes File last modification time Atime 8 bytes File last access time Ctime 8 bytes File creation time

Since
1.11

Field Summary

Modifier and TypeField and Description
private ZipEightByteInteger
private ZipEightByteInteger
public static final ZipShort
HEADER_ID

The header ID for this extra field.

private ZipEightByteInteger
private static final ZipShort
private static final ZipShort

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private static ZipEightByteInteger
dateToZip(final Date d)

public boolean
equals(final Object
the reference object with which to compare.
o
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.
private static ZipEightByteInteger
fileTimeToZip(final FileTime time)

public FileTime

Returns:

access time as a FileTime or null.
getAccessFileTime
()

Gets the access time as a FileTime of this ZIP entry, or null if no such timestamp exists in the ZIP entry.

public Date

Returns:

access time as java.util.Date or null.
getAccessJavaTime
()

Gets the access time as a java.util.Date of this ZIP entry, or null if no such timestamp exists in the ZIP entry.

public ZipEightByteInteger

Returns:

File last access time
getAccessTime
()

Gets the "File last access time" of this ZIP entry as a ZipEightByteInteger object, or ZipEightByteInteger#ZERO if no such timestamp exists in the ZIP entry.

public byte[]

Returns:

the central directory data
getCentralDirectoryData
()

Implements org.apache.commons.compress.archivers.zip.ZipExtraField.getCentralDirectoryData.

Gets the actual data to put into central directory data - without Header-ID or length specifier.
public ZipShort

Returns:

a ZipShort for the length of the data of this extra field
getCentralDirectoryLength
()

Implements org.apache.commons.compress.archivers.zip.ZipExtraField.getCentralDirectoryLength.

Gets the length of the extra field in the local file data - without Header-ID or length specifier.
public FileTime

Returns:

create time as a FileTime or null.
getCreateFileTime
()

Gets the create time as a FileTime of this ZIP entry, or null if no such timestamp exists in the ZIP entry.

public Date

Returns:

create time as java.util.Date or null.
getCreateJavaTime
()

Gets the create time as a java.util.Date of this ZIP entry, or null if no such timestamp exists in the ZIP entry.

public ZipEightByteInteger

Returns:

File creation time
getCreateTime
()

Gets the "File creation time" of this ZIP entry as a ZipEightByteInteger object, or ZipEightByteInteger#ZERO if no such timestamp exists in the ZIP entry.

public ZipShort

Returns:

the value for the header id for this extrafield
getHeaderId
()

Implements org.apache.commons.compress.archivers.zip.ZipExtraField.getHeaderId.

Gets the Header-ID.
public byte[]

Returns:

get the data
getLocalFileDataData
()

Implements org.apache.commons.compress.archivers.zip.ZipExtraField.getLocalFileDataData.

Gets the actual data to put into local file data - without Header-ID or length specifier.
public ZipShort

Returns:

a ZipShort for the length of the data of this extra field
getLocalFileDataLength
()

Implements org.apache.commons.compress.archivers.zip.ZipExtraField.getLocalFileDataLength.

Gets the length of the extra field in the local file data - without Header-ID or length specifier.
public FileTime

Returns:

modify time as a FileTime or null.
getModifyFileTime
()

Gets the modify time as a FileTime of this ZIP entry, or null if no such timestamp exists in the ZIP entry.

public Date

Returns:

modify time as java.util.Date or null.
getModifyJavaTime
()

Gets the modify time as a java.util.Date of this ZIP entry, or null if no such timestamp exists in the ZIP entry.

public ZipEightByteInteger

Returns:

File last modification time
getModifyTime
()

Gets the "File last modification time" of this ZIP entry as a ZipEightByteInteger object, or ZipEightByteInteger#ZERO if no such timestamp exists in the ZIP entry.

public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for the object.
public void
parseFromCentralDirectoryData(final byte[]
the buffer to read data from
buffer
,
final int
offset into buffer to read data
offset
,
final int
the length of data
length
)

Implements org.apache.commons.compress.archivers.zip.ZipExtraField.parseFromCentralDirectoryData.

Doesn't do anything special since this class always uses the same parsing logic for both central directory and local file data.
public void
parseFromLocalFileData(final byte[]
an array of bytes
data
,
int
the start offset
offset
,
final int
the number of bytes in the array from offset
length
)

Implements org.apache.commons.compress.archivers.zip.ZipExtraField.parseFromLocalFileData.

Populate data from this array as if it was in local file data.
private void
readTimeAttr(final byte[] data, int offset, final int length)

private void
reset()

Reset state back to newly constructed state.

public void
setAccessFileTime(final FileTime
access time as a FileTime
time
)

Sets the access time.

public void
setAccessJavaTime(final Date
access time as java.util.Date
d
)

Sets the access time as a java.util.Date of this ZIP entry.

public void
setAccessTime(final ZipEightByteInteger
ZipEightByteInteger of the access time
t
)

Sets the File last access time of this ZIP entry using a ZipEightByteInteger object.

public void
setCreateFileTime(final FileTime
create time as a FileTime
time
)

Sets the create time.

public void
setCreateJavaTime(final Date
create time as java.util.Date
d
)

Sets the create time as a java.util.Date of this ZIP entry.

public void
setCreateTime(final ZipEightByteInteger
ZipEightByteInteger of the create time
t
)

Sets the File creation time of this ZIP entry using a ZipEightByteInteger object.

public void
setModifyFileTime(final FileTime
modify time as a FileTime
time
)

Sets the modify time.

public void
setModifyJavaTime(final Date
modify time as java.util.Date
d
)

Sets the modify time as a java.util.Date of this ZIP entry.

public void
setModifyTime(final ZipEightByteInteger
ZipEightByteInteger of the modify time
t
)

Sets the File last modification time of this ZIP entry using a ZipEightByteInteger object.

public String

Returns:

A String representation of this class useful for debugging purposes.
toString
()

Overrides java.lang.Object.toString.

Returns a String representation of this class useful for debugging purposes.
private static Date
private static FileTime
Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

accessTimeback to summary
private ZipEightByteInteger accessTime
createTimeback to summary
private ZipEightByteInteger createTime
HEADER_IDback to summary
public static final ZipShort HEADER_ID

The header ID for this extra field.

Since
1.23
modifyTimeback to summary
private ZipEightByteInteger modifyTime
TIME_ATTR_SIZEback to summary
private static final ZipShort TIME_ATTR_SIZE
TIME_ATTR_TAGback to summary
private static final ZipShort TIME_ATTR_TAG

Constructor Detail

X000A_NTFSback to summary
public X000A_NTFS()

Method Detail

dateToZipback to summary
private static ZipEightByteInteger dateToZip(final Date d)
equalsback to summary
public boolean equals(final Object o)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
o:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
fileTimeToZipback to summary
private static ZipEightByteInteger fileTimeToZip(final FileTime time)
getAccessFileTimeback to summary
public FileTime getAccessFileTime()

Gets the access time as a FileTime of this ZIP entry, or null if no such timestamp exists in the ZIP entry.

Returns:FileTime

access time as a FileTime or null.

Since
1.23
getAccessJavaTimeback to summary
public Date getAccessJavaTime()

Gets the access time as a java.util.Date of this ZIP entry, or null if no such timestamp exists in the ZIP entry.

Returns:Date

access time as java.util.Date or null.

getAccessTimeback to summary
public ZipEightByteInteger getAccessTime()

Gets the "File last access time" of this ZIP entry as a ZipEightByteInteger object, or ZipEightByteInteger#ZERO if no such timestamp exists in the ZIP entry.

Returns:ZipEightByteInteger

File last access time

getCentralDirectoryDataback to summary
public byte[] getCentralDirectoryData()

Implements org.apache.commons.compress.archivers.zip.ZipExtraField.getCentralDirectoryData.

Gets the actual data to put into central directory data - without Header-ID or length specifier.

Returns:byte[]

the central directory data

Annotations
@Override
getCentralDirectoryLengthback to summary
public ZipShort getCentralDirectoryLength()

Implements org.apache.commons.compress.archivers.zip.ZipExtraField.getCentralDirectoryLength.

Gets the length of the extra field in the local file data - without Header-ID or length specifier.

For X5455 the central length is often smaller than the local length, because central cannot contain access or create timestamps.

Returns:ZipShort

a ZipShort for the length of the data of this extra field

Annotations
@Override
getCreateFileTimeback to summary
public FileTime getCreateFileTime()

Gets the create time as a FileTime of this ZIP entry, or null if no such timestamp exists in the ZIP entry.

Returns:FileTime

create time as a FileTime or null.

Since
1.23
getCreateJavaTimeback to summary
public Date getCreateJavaTime()

Gets the create time as a java.util.Date of this ZIP entry, or null if no such timestamp exists in the ZIP entry.

Returns:Date

create time as java.util.Date or null.

getCreateTimeback to summary
public ZipEightByteInteger getCreateTime()

Gets the "File creation time" of this ZIP entry as a ZipEightByteInteger object, or ZipEightByteInteger#ZERO if no such timestamp exists in the ZIP entry.

Returns:ZipEightByteInteger

File creation time

getHeaderIdback to summary
public ZipShort getHeaderId()

Implements org.apache.commons.compress.archivers.zip.ZipExtraField.getHeaderId.

Gets the Header-ID.

Returns:ZipShort

the value for the header id for this extrafield

Annotations
@Override
getLocalFileDataDataback to summary
public byte[] getLocalFileDataData()

Implements org.apache.commons.compress.archivers.zip.ZipExtraField.getLocalFileDataData.

Gets the actual data to put into local file data - without Header-ID or length specifier.

Returns:byte[]

get the data

Annotations
@Override
getLocalFileDataLengthback to summary
public ZipShort getLocalFileDataLength()

Implements org.apache.commons.compress.archivers.zip.ZipExtraField.getLocalFileDataLength.

Gets the length of the extra field in the local file data - without Header-ID or length specifier.

Returns:ZipShort

a ZipShort for the length of the data of this extra field

Annotations
@Override
getModifyFileTimeback to summary
public FileTime getModifyFileTime()

Gets the modify time as a FileTime of this ZIP entry, or null if no such timestamp exists in the ZIP entry.

Returns:FileTime

modify time as a FileTime or null.

Since
1.23
getModifyJavaTimeback to summary
public Date getModifyJavaTime()

Gets the modify time as a java.util.Date of this ZIP entry, or null if no such timestamp exists in the ZIP entry.

Returns:Date

modify time as java.util.Date or null.

getModifyTimeback to summary
public ZipEightByteInteger getModifyTime()

Gets the "File last modification time" of this ZIP entry as a ZipEightByteInteger object, or ZipEightByteInteger#ZERO if no such timestamp exists in the ZIP entry.

Returns:ZipEightByteInteger

File last modification time

hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for the object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object.

Annotations
@Override
parseFromCentralDirectoryDataback to summary
public void parseFromCentralDirectoryData(final byte[] buffer, final int offset, final int length) throws ZipException

Implements org.apache.commons.compress.archivers.zip.ZipExtraField.parseFromCentralDirectoryData.

Doesn't do anything special since this class always uses the same parsing logic for both central directory and local file data.

Parameters
buffer:byte[]

Doc from org.apache.commons.compress.archivers.zip.ZipExtraField.parseFromCentralDirectoryData.

the buffer to read data from

offset:int

Doc from org.apache.commons.compress.archivers.zip.ZipExtraField.parseFromCentralDirectoryData.

offset into buffer to read data

length:int

Doc from org.apache.commons.compress.archivers.zip.ZipExtraField.parseFromCentralDirectoryData.

the length of data

Annotations
@Override
Exceptions
ZipException:

Doc from org.apache.commons.compress.archivers.zip.ZipExtraField.parseFromCentralDirectoryData.

on error

parseFromLocalFileDataback to summary
public void parseFromLocalFileData(final byte[] data, int offset, final int length) throws ZipException

Implements org.apache.commons.compress.archivers.zip.ZipExtraField.parseFromLocalFileData.

Populate data from this array as if it was in local file data.

Parameters
data:byte[]

an array of bytes

offset:int

the start offset

length:int

the number of bytes in the array from offset

Annotations
@Override
Exceptions
ZipException:
on error
readTimeAttrback to summary
private void readTimeAttr(final byte[] data, int offset, final int length)
resetback to summary
private void reset()

Reset state back to newly constructed state. Helps us make sure parse() calls always generate clean results.

setAccessFileTimeback to summary
public void setAccessFileTime(final FileTime time)

Sets the access time.

Parameters
time:FileTime

access time as a FileTime

Since
1.23
setAccessJavaTimeback to summary
public void setAccessJavaTime(final Date d)

Sets the access time as a java.util.Date of this ZIP entry.

Parameters
d:Date

access time as java.util.Date

setAccessTimeback to summary
public void setAccessTime(final ZipEightByteInteger t)

Sets the File last access time of this ZIP entry using a ZipEightByteInteger object.

Parameters
t:ZipEightByteInteger

ZipEightByteInteger of the access time

setCreateFileTimeback to summary
public void setCreateFileTime(final FileTime time)

Sets the create time.

Parameters
time:FileTime

create time as a FileTime

Since
1.23
setCreateJavaTimeback to summary
public void setCreateJavaTime(final Date d)

Sets the create time as a java.util.Date of this ZIP entry. Supplied value is truncated to per-second precision (milliseconds zeroed-out).

Note

the setters for flags and timestamps are decoupled. Even if the timestamp is not-null, it will only be written out if the corresponding bit in the flags is also set.

Parameters
d:Date

create time as java.util.Date

setCreateTimeback to summary
public void setCreateTime(final ZipEightByteInteger t)

Sets the File creation time of this ZIP entry using a ZipEightByteInteger object.

Parameters
t:ZipEightByteInteger

ZipEightByteInteger of the create time

setModifyFileTimeback to summary
public void setModifyFileTime(final FileTime time)

Sets the modify time.

Parameters
time:FileTime

modify time as a FileTime

Since
1.23
setModifyJavaTimeback to summary
public void setModifyJavaTime(final Date d)

Sets the modify time as a java.util.Date of this ZIP entry.

Parameters
d:Date

modify time as java.util.Date

setModifyTimeback to summary
public void setModifyTime(final ZipEightByteInteger t)

Sets the File last modification time of this ZIP entry using a ZipEightByteInteger object.

Parameters
t:ZipEightByteInteger

ZipEightByteInteger of the modify time

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Returns a String representation of this class useful for debugging purposes.

Returns:String

A String representation of this class useful for debugging purposes.

Annotations
@Override
zipToDateback to summary
private static Date zipToDate(final ZipEightByteInteger z)
zipToFileTimeback to summary
private static FileTime zipToFileTime(final ZipEightByteInteger z)