public class AsiExtraField extends java.lang.Object implements ZipExtraField, UnixStat, java.lang.Cloneable
This class uses the ASi extra field in the format:
Value Size Description ----- ---- ----------- (Unix3) 0x756e Short tag for this extra block type TSize Short total data size for this block CRC Long CRC-32 of the remaining data Mode Short file permissions SizDev Long symlink'd size OR major/minor dev num UID Short user ID GID Short group ID (var.) variable symbolic link filenametaken from appnote.iz (Info-ZIP note, 981119) found at ftp://ftp.uu.net/pub/archiving/zip/doc/
Short is two bytes and Long is four bytes in big endian byte and word order, device numbers are currently not supported.
Modifier and Type | Field and Description |
---|---|
private static ZipShort |
HEADER_ID |
private java.util.zip.CRC32 |
m_crc
Instance used to calculate checksums.
|
private boolean |
m_dirFlag
Is this an entry for a directory?
|
private int |
m_gid
Group ID.
|
private java.lang.String |
m_link
File this entry points to, if it is a symbolic link.
|
private int |
m_mode
Standard Unix stat(2) file mode.
|
private int |
m_uid
User ID.
|
DEFAULT_DIR_PERM, DEFAULT_FILE_PERM, DEFAULT_LINK_PERM, DIR_FLAG, FILE_FLAG, LINK_FLAG, PERM_MASK
Constructor and Description |
---|
AsiExtraField() |
Modifier and Type | Method and Description |
---|---|
byte[] |
getCentralDirectoryData()
Delegate to local file data.
|
ZipShort |
getCentralDirectoryLength()
Delegate to local file data.
|
int |
getGroupId()
Deprecated.
Use getGroupID() instead
|
int |
getGroupID()
Get the group id.
|
ZipShort |
getHeaderID()
The Header-ID.
|
java.lang.String |
getLinkedFile()
Name of linked file
|
byte[] |
getLocalFileDataData()
The actual data to put into local file data - without Header-ID or length
specifier.
|
ZipShort |
getLocalFileDataLength()
Length of the extra field in the local file data - without Header-ID or
length specifier.
|
int |
getMode()
File mode of this file.
|
protected int |
getMode(int mode)
Get the file mode for given permissions with the correct file type.
|
int |
getUserId()
Deprecated.
Use getUserID()
|
int |
getUserID()
Get the user id.
|
boolean |
isDirectory()
Is this entry a directory?
|
boolean |
isLink()
Is this entry a symbolic link?
|
void |
parseFromLocalFileData(byte[] buffer,
int offset,
int length)
Populate data from this array as if it was in local file data.
|
void |
setDirectory(boolean dirFlag)
Indicate whether this entry is a directory.
|
void |
setGroupId(int gid)
Set the group id.
|
void |
setLinkedFile(java.lang.String name)
Indicate that this entry is a symbolic link to the given filename.
|
void |
setMode(int mode)
File mode of this file.
|
void |
setUserId(int uid)
Deprecated.
Use setUserID(int)
|
void |
setUserID(int uid)
Set the user id.
|
private static final ZipShort HEADER_ID
private int m_mode
private int m_uid
private int m_gid
private java.lang.String m_link
empty string - if entry is not a symbolic link.
private boolean m_dirFlag
private java.util.zip.CRC32 m_crc
public void setDirectory(boolean dirFlag)
dirFlag
- The new Directory valuepublic void setGroupId(int gid)
gid
- The new GroupId valuepublic void setLinkedFile(java.lang.String name)
name
- Name of the file this entry links to, empty String if it is
not a symbolic link.public void setMode(int mode)
mode
- The new Mode valuepublic void setUserId(int uid)
uid
- The new UserId valuesetUserID(int)
public void setUserID(int uid)
uid
- The new UserId valuepublic byte[] getCentralDirectoryData()
getCentralDirectoryData
in interface ZipExtraField
public ZipShort getCentralDirectoryLength()
getCentralDirectoryLength
in interface ZipExtraField
public int getGroupID()
public int getGroupId()
getGroupID()
public ZipShort getHeaderID()
getHeaderID
in interface ZipExtraField
public java.lang.String getLinkedFile()
public byte[] getLocalFileDataData()
getLocalFileDataData
in interface ZipExtraField
public ZipShort getLocalFileDataLength()
getLocalFileDataLength
in interface ZipExtraField
public int getMode()
public int getUserId()
getUserID()
public int getUserID()
public boolean isDirectory()
public boolean isLink()
public void parseFromLocalFileData(byte[] buffer, int offset, int length) throws java.util.zip.ZipException
parseFromLocalFileData
in interface ZipExtraField
buffer
- the bufferoffset
- the offset into bufferlength
- the length of data in bufferjava.util.zip.ZipException
- on errorprotected int getMode(int mode)
mode
- Description of Parameter