中央目录信息
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 |