中央目錄資訊
public final class CentralDirectoryInfo
extends Object
java.lang.Object | |
↳ | com.android.tradefed.util.zip.CentralDirectoryInfo |
CentralDirectoryInfo 是一個包含 zip 檔案內檔案/資料夾資訊的類別。
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 :資訊塊的起始偏移量。 |
投擲 | |
---|---|
| IO異常 |
中央目錄資訊
public CentralDirectoryInfo (byte[] data, int startOffset, boolean useZip64)
用於收集 zip 檔案內文件條目資訊的建構子。
參數 | |
---|---|
data | byte :包含檔案條目資訊的資料的byte[] 。 |
startOffset | int :資訊塊的起始偏移量。 |
useZip64 | boolean :支援部分下載 zip64 格式的布林值。 |
投擲 | |
---|---|
| IO異常 |
受保護的構造函數
中央目錄資訊
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 |
取得本地報頭偏移量
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 |
設定本地標題偏移量
public void setLocalHeaderOffset (long localHeaderOffset)
設定本地文件頭條目的偏移量。
參數 | |
---|---|
localHeaderOffset | long |
設定未壓縮大小
public void setUncompressedSize (long uncompressedSize)
設定未壓縮的大小。
參數 | |
---|---|
uncompressedSize | long |
到字串
public String toString ()
退貨 | |
---|---|
String |