Class CentralDirectoryHeader
- java.lang.Object
-
- com.android.tools.build.apkzlib.zip.CentralDirectoryHeader
-
- All Implemented Interfaces:
java.lang.Cloneable
public class CentralDirectoryHeader extends java.lang.Object implements java.lang.CloneableThe Central Directory Header contains information about files stored in the zip. Instances of this class contain information for files that already are in the zip and, for which the data was read from the Central Directory. But some instances of this class are used for new files. Because instances of this class can refer to files not yet on the zip, some of the fields may not be filled in, or may be filled in with default values.Because compression decision is done lazily, some data is stored with futures.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected CentralDirectoryHeaderclone()byte[]getComment()Obtains the entry's comment.java.util.concurrent.Future<CentralDirectoryHeaderCompressInfo>getCompressionInfo()Obtains the future with the compression information.CentralDirectoryHeaderCompressInfogetCompressionInfoWithWait()Equivalent togetCompressionInfo().get()but masking the possible exceptions and guaranteeing non-nullreturn.longgetCrc32()Obtains the CRC32 of the data.byte[]getEncodedFileName()Obtains the encoded file name.longgetExternalAttributes()Obtains the entry's external attributes.ExtraFieldgetExtraField()Obtains the data in the extra field.com.android.tools.build.apkzlib.zip.GPFlagsgetGpBit()Obtains the general-purpose bit flag.longgetInternalAttributes()Obtains the entry's internal attributes.longgetLastModDate()Obtains the last modification date of the entry.longgetLastModTime()Obtains the last modification time of the entry.longgetMadeBy()Obtains the code of the program that made the zip.java.lang.StringgetName()Obtains the name of the file.longgetOffset()Obtains the offset in the zip file where this entry's data is.longgetUncompressedSize()Obtains the size of the uncompressed file.voidsetExtraField(ExtraField extraField)Sets the data in the extra field.
-
-
-
Method Detail
-
getName
public java.lang.String getName()
Obtains the name of the file.- Returns:
- the name
-
getUncompressedSize
public long getUncompressedSize()
Obtains the size of the uncompressed file.- Returns:
- the size of the file
-
getCrc32
public long getCrc32()
Obtains the CRC32 of the data.- Returns:
- the CRC32, 0 if not yet computed
-
getMadeBy
public long getMadeBy()
Obtains the code of the program that made the zip.- Returns:
- the code
-
getGpBit
public com.android.tools.build.apkzlib.zip.GPFlags getGpBit()
Obtains the general-purpose bit flag.- Returns:
- the bit flag
-
getLastModTime
public long getLastModTime()
Obtains the last modification time of the entry.- Returns:
- the last modification time in MS-DOS format (see
MsDosDateTimeUtils.packTime(long))
-
getLastModDate
public long getLastModDate()
Obtains the last modification date of the entry.- Returns:
- the last modification date in MS-DOS format (see
MsDosDateTimeUtils.packDate(long))
-
getExtraField
public ExtraField getExtraField()
Obtains the data in the extra field.- Returns:
- the data (returns an empty array if there is none)
-
setExtraField
public void setExtraField(ExtraField extraField)
Sets the data in the extra field.- Parameters:
extraField- the data to set
-
getComment
public byte[] getComment()
Obtains the entry's comment.- Returns:
- the comment (returns an empty array if there is no comment)
-
getInternalAttributes
public long getInternalAttributes()
Obtains the entry's internal attributes.- Returns:
- the entry's internal attributes
-
getExternalAttributes
public long getExternalAttributes()
Obtains the entry's external attributes.- Returns:
- the entry's external attributes
-
getOffset
public long getOffset()
Obtains the offset in the zip file where this entry's data is.- Returns:
- the offset or
-1if the file has no data in the zip and, therefore, data is stored in memory
-
getEncodedFileName
public byte[] getEncodedFileName()
Obtains the encoded file name.- Returns:
- the encoded file name
-
clone
protected CentralDirectoryHeader clone() throws java.lang.CloneNotSupportedException
- Overrides:
clonein classjava.lang.Object- Throws:
java.lang.CloneNotSupportedException
-
getCompressionInfo
public java.util.concurrent.Future<CentralDirectoryHeaderCompressInfo> getCompressionInfo()
Obtains the future with the compression information.- Returns:
- the information
-
getCompressionInfoWithWait
public CentralDirectoryHeaderCompressInfo getCompressionInfoWithWait() throws java.io.IOException
Equivalent togetCompressionInfo().get()but masking the possible exceptions and guaranteeing non-nullreturn.- Returns:
- the result of the future
- Throws:
java.io.IOException- failed to get the information
-
-