Class X7875_NewUnix
- java.lang.Object
 - 
- org.apache.commons.compress.archivers.zip.X7875_NewUnix
 
 
- 
- All Implemented Interfaces:
 java.io.Serializable,java.lang.Cloneable,ZipExtraField
public class X7875_NewUnix extends java.lang.Object implements ZipExtraField, java.lang.Cloneable, java.io.Serializable
An extra field that stores UNIX UID/GID data (owner & group ownership) for a given ZIP entry. We're using the field definition given in Info-Zip's source archive: zip-3.0.tar.gz/proginfo/extrafld.txtLocal-header version: Value Size Description ----- ---- ----------- 0x7875 Short tag for this extra block type ("ux") TSize Short total data size for this block Version 1 byte version of this extra field, currently 1 UIDSize 1 byte Size of UID field UID Variable UID for this entry (little-endian) GIDSize 1 byte Size of GID field GID Variable GID for this entry (little-endian) Central-header version: Value Size Description ----- ---- ----------- 0x7855 Short tag for this extra block type ("Ux") TSize Short total data size for this block (0)- Since:
 - 1.5
 - See Also:
 - Serialized Form
 
 
- 
- 
Field Summary
- 
Fields inherited from interface org.apache.commons.compress.archivers.zip.ZipExtraField
EXTRAFIELD_HEADER_SIZE 
 - 
 
- 
Constructor Summary
Constructors Constructor Description X7875_NewUnix()Constructor for X7875_NewUnix. 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Objectclone()booleanequals(java.lang.Object o)byte[]getCentralDirectoryData()The actual data to put into central directory data - without Header-ID or length specifier.ZipShortgetCentralDirectoryLength()Length of the extra field in the central directory data - without Header-ID or length specifier.longgetGID()Gets the GID as a long.ZipShortgetHeaderId()The Header-ID.byte[]getLocalFileDataData()The actual data to put into local file data - without Header-ID or length specifier.ZipShortgetLocalFileDataLength()Length of the extra field in the local file data - without Header-ID or length specifier.longgetUID()Gets the UID as a long.inthashCode()voidparseFromCentralDirectoryData(byte[] buffer, int offset, int length)Doesn't do anything since this class doesn't store anything inside the central directory.voidparseFromLocalFileData(byte[] data, int offset, int length)Populate data from this array as if it was in local file data.voidsetGID(long l)Sets the GID.voidsetUID(long l)Sets the UID.java.lang.StringtoString()Returns a String representation of this class useful for debugging purposes. 
 - 
 
- 
- 
Method Detail
- 
clone
public java.lang.Object clone() throws java.lang.CloneNotSupportedException- Throws:
 java.lang.CloneNotSupportedException
 
- 
equals
public boolean equals(java.lang.Object o)
- Overrides:
 equalsin classjava.lang.Object
 
- 
getCentralDirectoryData
public byte[] getCentralDirectoryData()
The actual data to put into central directory data - without Header-ID or length specifier.- Specified by:
 getCentralDirectoryDatain interfaceZipExtraField- Returns:
 - get the data
 
 
- 
getCentralDirectoryLength
public ZipShort getCentralDirectoryLength()
Length of the extra field in the central directory data - without Header-ID or length specifier.- Specified by:
 getCentralDirectoryLengthin interfaceZipExtraField- Returns:
 - a 
ZipShortfor the length of the data of this extra field 
 
- 
getGID
public long getGID()
Gets the GID as a long. GID is typically a 32 bit unsigned value on most UNIX systems, so we return a long to avoid integer overflow into the negatives in case values above and including 2^31 are being used.- Returns:
 - the GID value.
 
 
- 
getHeaderId
public ZipShort getHeaderId()
The Header-ID.- Specified by:
 getHeaderIdin interfaceZipExtraField- Returns:
 - the value for the header id for this extrafield
 
 
- 
getLocalFileDataData
public byte[] getLocalFileDataData()
The actual data to put into local file data - without Header-ID or length specifier.- Specified by:
 getLocalFileDataDatain interfaceZipExtraField- Returns:
 - get the data
 
 
- 
getLocalFileDataLength
public ZipShort getLocalFileDataLength()
Length of the extra field in the local file data - without Header-ID or length specifier.- Specified by:
 getLocalFileDataLengthin interfaceZipExtraField- Returns:
 - a 
ZipShortfor the length of the data of this extra field 
 
- 
getUID
public long getUID()
Gets the UID as a long. UID is typically a 32 bit unsigned value on most UNIX systems, so we return a long to avoid integer overflow into the negatives in case values above and including 2^31 are being used.- Returns:
 - the UID value.
 
 
- 
hashCode
public int hashCode()
- Overrides:
 hashCodein classjava.lang.Object
 
- 
parseFromCentralDirectoryData
public void parseFromCentralDirectoryData(byte[] buffer, int offset, int length) throws java.util.zip.ZipExceptionDoesn't do anything since this class doesn't store anything inside the central directory.- Specified by:
 parseFromCentralDirectoryDatain interfaceZipExtraField- Parameters:
 buffer- the buffer to read data fromoffset- offset into buffer to read datalength- the length of data- Throws:
 java.util.zip.ZipException- on error
 
- 
parseFromLocalFileData
public void parseFromLocalFileData(byte[] data, int offset, int length) throws java.util.zip.ZipExceptionPopulate data from this array as if it was in local file data.- Specified by:
 parseFromLocalFileDatain interfaceZipExtraField- Parameters:
 data- an array of bytesoffset- the start offsetlength- the number of bytes in the array from offset- Throws:
 java.util.zip.ZipException- on error
 
- 
setGID
public void setGID(long l)
Sets the GID.- Parameters:
 l- GID value to set on this extra field.
 
- 
setUID
public void setUID(long l)
Sets the UID.- Parameters:
 l- UID value to set on this extra field.
 
- 
toString
public java.lang.String toString()
Returns a String representation of this class useful for debugging purposes.- Overrides:
 toStringin classjava.lang.Object- Returns:
 - A String representation of this class useful for debugging purposes.
 
 
 - 
 
 -