中央目錄信息
public final class CentralDirectoryInfo
extends Object
java.lang.Object | |
↳ | com.android.tradefed.util.zip.CentralDirectoryInfo |
CentralDirectoryInfo 是一個包含 zip 文件中文件/文件夾信息的類。
整體壓縮文件格式:[本地文件頭+壓縮數據[+擴展本地頭]?]*[中心目錄]*[中心目錄記錄結束]
有關詳細信息,請參閱以下鏈接:https://en.wikipedia.org/wiki/Zip_(file_format)
概括
公共構造函數 | |
---|---|
CentralDirectoryInfo (byte[] data, int startOffset) 用於收集 zip 文件中文件條目信息的構造函數。 | |
CentralDirectoryInfo (byte[] data, int startOffset, boolean useZip64) 用於收集 zip 文件中文件條目信息的構造函數。 |
受保護的構造函數 | |
---|---|
CentralDirectoryInfo () 用於單元測試的默認構造函數。 |
公共方法 | |
---|---|
boolean | equals (Object o) |
int | getCompressedSize () 獲取壓縮後的大小。 |
int | getCompressionMethod () 獲取壓縮方法。 |
long | getCrc () 獲取文件的 CRC。 |
long | getExternalFileAttributes () 獲取外部文件屬性。 |
int | getExtraFieldLength () 獲取額外的字段長度。 |
int | getFileCommentLength () 獲取文件註釋長度。 |
String | getFileName () 獲取包含相對路徑的文件名。 |
int | getFileNameLength () 獲取文件名長度。 |
int | getFilePermission () 獲取Linux文件權限,保存在外部文件屬性的後9位。 |
int | getInfoSize () 獲取中央目錄條目的大小。 |
int | getInternalFileAttributes () 獲取內部文件屬性。 |
long | getLocalHeaderOffset () 獲取本地文件頭條目的偏移量。 |
long | getUncompressedSize () 獲取未壓縮的大小。 |
int | hashCode () |
void | setCompressedSize (long compressionSize) 設置壓縮後的大小。 |
void | setCompressionMethod (int compressionMethod) 設置壓縮方式。 |
void | setCrc (long crc) 設置文件的 CRC。 |
void | setExternalFileAttributes (long externalFileAttributes) 設置外部文件屬性。 |
void | setExtraFieldLength (int extraFieldLength) 設置額外字段長度。 |
void | setFileCommentLength (int fileCommentLength) 設置文件註釋長度。 |
void | setFileName (String fileName) 設置包含相對路徑的文件名。 |
void | setFileNameLength (int fileNameLength) 設置文件名長度。 |
void | setInternalFileAttributes (int internalFileAttributes) 設置內部文件屬性。 |
void | setLocalHeaderOffset (long localHeaderOffset) 設置本地文件頭條目的偏移量。 |
void | setUncompressedSize (long uncompressedSize) 設置未壓縮的大小。 |
String | toString () |
公共構造函數
中央目錄信息
public CentralDirectoryInfo (byte[] data, int startOffset)
用於收集 zip 文件中文件條目信息的構造函數。
參數 | |
---|---|
data | byte : byte[] 數據,包含文件條目的信息。 |
startOffset | int :信息塊的起始偏移量。 |
投擲 | |
---|---|
| 異常 |
中央目錄信息
public CentralDirectoryInfo (byte[] data, int startOffset, boolean useZip64)
用於收集 zip 文件中文件條目信息的構造函數。
參數 | |
---|---|
data | byte : byte[] 數據,包含文件條目的信息。 |
startOffset | int :信息塊的起始偏移量。 |
useZip64 | boolean : 在部分下載中支持 zip64 格式的布爾值。 |
投擲 | |
---|---|
| 異常 |
受保護的構造函數
中央目錄信息
protected CentralDirectoryInfo ()
用於單元測試的默認構造函數。
公共方法
等於
public boolean equals (Object o)
參數 | |
---|---|
o | Object |
退貨 | |
---|---|
boolean |
獲取壓縮大小
public int getCompressedSize ()
獲取壓縮後的大小。
退貨 | |
---|---|
int |
獲取壓縮方法
public int getCompressionMethod ()
獲取壓縮方法。
退貨 | |
---|---|
int |
獲取CRC
public long getCrc ()
獲取文件的 CRC。
退貨 | |
---|---|
long |
獲取外部文件屬性
public long getExternalFileAttributes ()
獲取外部文件屬性。
退貨 | |
---|---|
long |
獲取額外字段長度
public int getExtraFieldLength ()
獲取額外的字段長度。
退貨 | |
---|---|
int |
獲取文件註釋長度
public int getFileCommentLength ()
獲取文件註釋長度。
退貨 | |
---|---|
int |
獲取文件名
public String getFileName ()
獲取包含相對路徑的文件名。
退貨 | |
---|---|
String |
獲取文件名長度
public int getFileNameLength ()
獲取文件名長度。
退貨 | |
---|---|
int |
獲取文件權限
public int getFilePermission ()
獲取Linux文件權限,保存在外部文件屬性的後9位。
退貨 | |
---|---|
int |
獲取信息大小
public int getInfoSize ()
獲取中央目錄條目的大小。
退貨 | |
---|---|
int |
獲取內部文件屬性
public int getInternalFileAttributes ()
獲取內部文件屬性。
退貨 | |
---|---|
int |
getLocalHeaderOffset
public long getLocalHeaderOffset ()
獲取本地文件頭條目的偏移量。
退貨 | |
---|---|
long |
得到未壓縮的大小
public long getUncompressedSize ()
獲取未壓縮的大小。
退貨 | |
---|---|
long |
哈希碼
public int hashCode ()
退貨 | |
---|---|
int |
設置壓縮尺寸
public void setCompressedSize (long compressionSize)
設置壓縮後的大小。
參數 | |
---|---|
compressionSize | long |
設置壓縮方法
public void setCompressionMethod (int compressionMethod)
設置壓縮方式。
參數 | |
---|---|
compressionMethod | int |
設置CRC
public void setCrc (long crc)
設置文件的 CRC。
參數 | |
---|---|
crc | long |
設置外部文件屬性
public void setExternalFileAttributes (long externalFileAttributes)
設置外部文件屬性。
參數 | |
---|---|
externalFileAttributes | long |
設置額外字段長度
public void setExtraFieldLength (int extraFieldLength)
設置額外字段長度。
參數 | |
---|---|
extraFieldLength | int |
設置文件註釋長度
public void setFileCommentLength (int fileCommentLength)
設置文件註釋長度。
參數 | |
---|---|
fileCommentLength | int |
設置文件名
public void setFileName (String fileName)
設置包含相對路徑的文件名。
參數 | |
---|---|
fileName | String |
設置文件名長度
public void setFileNameLength (int fileNameLength)
設置文件名長度。
參數 | |
---|---|
fileNameLength | int |
設置內部文件屬性
public void setInternalFileAttributes (int internalFileAttributes)
設置內部文件屬性。
參數 | |
---|---|
internalFileAttributes | int |
setLocalHeaderOffset
public void setLocalHeaderOffset (long localHeaderOffset)
設置本地文件頭條目的偏移量。
參數 | |
---|---|
localHeaderOffset | long |
設置未壓縮大小
public void setUncompressedSize (long uncompressedSize)
設置未壓縮的大小。
參數 | |
---|---|
uncompressedSize | long |
到字符串
public String toString ()
退貨 | |
---|---|
String |