Package org.apache.tools.zip
Class AsiExtraField
java.lang.Object
org.apache.tools.zip.AsiExtraField
- All Implemented Interfaces:
- java.lang.Cloneable,- UnixStat,- ZipExtraField
public class AsiExtraField extends java.lang.Object implements ZipExtraField, UnixStat, java.lang.Cloneable
Adds Unix file permission and UID/GID fields as well as symbolic
 link handling.
 
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 filename
 
 taken 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.
Since the documentation this class is based upon doesn't mention the character encoding of the file name at all, it is assumed that it uses the current platform's default encoding.
- 
Field SummaryFields inherited from interface org.apache.tools.zip.UnixStatDEFAULT_DIR_PERM, DEFAULT_FILE_PERM, DEFAULT_LINK_PERM, DIR_FLAG, FILE_FLAG, LINK_FLAG, PERM_MASK
- 
Constructor SummaryConstructors Constructor Description AsiExtraField()Constructor for AsiExtraField.
- 
Method SummaryModifier and Type Method Description java.lang.Objectclone()byte[]getCentralDirectoryData()Delegate to local file data.ZipShortgetCentralDirectoryLength()Delegate to local file data.intgetGroupId()Get the group id.ZipShortgetHeaderId()The Header-ID.java.lang.StringgetLinkedFile()Name of linked filebyte[]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.intgetMode()File mode of this file.protected intgetMode(int mode)Get the file mode for given permissions with the correct file type.intgetUserId()Get the user id.booleanisDirectory()Is this entry a directory?booleanisLink()Is this entry a symbolic link?voidparseFromLocalFileData(byte[] data, int offset, int length)Populate data from this array as if it was in local file data.voidsetDirectory(boolean dirFlag)Indicate whether this entry is a directory.voidsetGroupId(int gid)Set the group id.voidsetLinkedFile(java.lang.String name)Indicate that this entry is a symbolic link to the given filename.voidsetMode(int mode)File mode of this file.voidsetUserId(int uid)Set the user id.
- 
Constructor Details- 
AsiExtraFieldpublic AsiExtraField()Constructor for AsiExtraField.
 
- 
- 
Method Details- 
getHeaderIdThe Header-ID.- Specified by:
- getHeaderIdin interface- ZipExtraField
- Returns:
- the value for the header id for this extrafield
- Since:
- 1.1
 
- 
getLocalFileDataLengthLength of the extra field in the local file data - without Header-ID or length specifier.- Specified by:
- getLocalFileDataLengthin interface- ZipExtraField
- Returns:
- a ZipShortfor the length of the data of this extra field
- Since:
- 1.1
 
- 
getCentralDirectoryLengthDelegate to local file data.- Specified by:
- getCentralDirectoryLengthin interface- ZipExtraField
- Returns:
- the centralDirectory length
- Since:
- 1.1
 
- 
getLocalFileDataDatapublic byte[] getLocalFileDataData()The actual data to put into local file data - without Header-ID or length specifier.- Specified by:
- getLocalFileDataDatain interface- ZipExtraField
- Returns:
- get the data
- Since:
- 1.1
 
- 
getCentralDirectoryDatapublic byte[] getCentralDirectoryData()Delegate to local file data.- Specified by:
- getCentralDirectoryDatain interface- ZipExtraField
- Returns:
- the local file data
- Since:
- 1.1
 
- 
setUserIdpublic void setUserId(int uid)Set the user id.- Parameters:
- uid- the user id
- Since:
- 1.1
 
- 
getUserIdpublic int getUserId()Get the user id.- Returns:
- the user id
- Since:
- 1.1
 
- 
setGroupIdpublic void setGroupId(int gid)Set the group id.- Parameters:
- gid- the group id
- Since:
- 1.1
 
- 
getGroupIdpublic int getGroupId()Get the group id.- Returns:
- the group id
- Since:
- 1.1
 
- 
setLinkedFilepublic void setLinkedFile(java.lang.String name)Indicate that this entry is a symbolic link to the given filename.- Parameters:
- name- Name of the file this entry links to, empty String if it is not a symbolic link.
- Since:
- 1.1
 
- 
getLinkedFilepublic java.lang.String getLinkedFile()Name of linked file- Returns:
- name of the file this entry links to if it is a symbolic link, the empty string otherwise.
- Since:
- 1.1
 
- 
isLinkpublic boolean isLink()Is this entry a symbolic link?- Returns:
- true if this is a symbolic link
- Since:
- 1.1
 
- 
setModepublic void setMode(int mode)File mode of this file.- Parameters:
- mode- the file mode
- Since:
- 1.1
 
- 
getModepublic int getMode()File mode of this file.- Returns:
- the file mode
- Since:
- 1.1
 
- 
setDirectorypublic void setDirectory(boolean dirFlag)Indicate whether this entry is a directory.- Parameters:
- dirFlag- if true, this entry is a directory
- Since:
- 1.1
 
- 
isDirectorypublic boolean isDirectory()Is this entry a directory?- Returns:
- true if this entry is a directory
- Since:
- 1.1
 
- 
parseFromLocalFileDatapublic 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 interface- ZipExtraField
- Parameters:
- data- an array of bytes
- offset- the start offset
- length- the number of bytes in the array from offset
- Throws:
- java.util.zip.ZipException- on error
- Since:
- 1.1
 
- 
getModeprotected int getMode(int mode)Get the file mode for given permissions with the correct file type.- Parameters:
- mode- the mode
- Returns:
- the type with the mode
- Since:
- 1.1
 
- 
clonepublic java.lang.Object clone()- Overrides:
- clonein class- java.lang.Object
 
 
-