CentralDirectoryInfo

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()

获取存储在外部文件属性的最后 9 位的 Linux 文件权限。

int getInfoSize()

获取中央目录条目的大小。

int getInternalFileAttributes()

获取内部文件属性。

long getLocalHeaderOffset()

获取本地文件头文件条目的偏移量。

long getUncompressedSize()

获取未压缩的大小。

int hashCode()
boolean isSymLink()

检查这是否为符号链接。

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()

公共构造函数

CentralDirectoryInfo

public CentralDirectoryInfo (byte[] data, 
                int startOffset)

用于收集 zip 文件中的文件条目信息的构造函数。

参数
data byte:包含文件条目信息的数据的 byte[]

startOffset int:信息块的起始偏移量。

抛出
IOException

CentralDirectoryInfo

public CentralDirectoryInfo (byte[] data, 
                int startOffset, 
                boolean useZip64)

用于收集 zip 文件中的文件条目信息的构造函数。

参数
data byte:包含文件条目信息的数据的 byte[]

startOffset int:信息块的起始偏移量。

useZip64 boolean:一个布尔值,用于支持部分下载中的 zip64 格式。

抛出
IOException

受保护的构造函数

CentralDirectoryInfo

protected CentralDirectoryInfo ()

用于单元测试的默认构造函数。

公共方法

equals

public boolean equals (Object o)

参数
o Object

返回
boolean

getCompressedSize

public int getCompressedSize ()

获取压缩后的大小。

返回
int

getCompressionMethod

public int getCompressionMethod ()

获取压缩方法。

返回
int

getCrc

public long getCrc ()

获取文件的 CRC。

返回
long

getExternalFileAttributes

public long getExternalFileAttributes ()

获取外部文件属性。

返回
long

getExtraFieldLength

public int getExtraFieldLength ()

获取额外字段长度。

返回
int

getFileCommentLength

public int getFileCommentLength ()

获取文件评论长度。

返回
int

getFileName

public String getFileName ()

获取包含相对路径的文件名。

返回
String

getFileNameLength

public int getFileNameLength ()

获取文件名长度。

返回
int

getFilePermission

public int getFilePermission ()

获取存储在外部文件属性后 9 位的 Linux 文件权限。

返回
int

getInfoSize

public int getInfoSize ()

获取中央目录条目的大小。

返回
int

getInternalFileAttributes

public int getInternalFileAttributes ()

获取内部文件属性。

返回
int

getLocalHeaderOffset

public long getLocalHeaderOffset ()

获取本地文件标头条目的偏移量。

返回
long

getUncompressedSize(获取未压缩大小)

public long getUncompressedSize ()

获取未压缩的大小。

返回
long

hashCode

public int hashCode ()

返回
int

isSymLink

public boolean isSymLink ()

检查这是否为符号链接。

返回
boolean

setCompressedSize

public void setCompressedSize (long compressionSize)

设置压缩后的大小。

参数
compressionSize long

setCompressionMethod

public void setCompressionMethod (int compressionMethod)

设置压缩方法。

参数
compressionMethod int

setCrc

public void setCrc (long crc)

设置文件的 CRC。

参数
crc long

setExternalFileAttributes

public void setExternalFileAttributes (long externalFileAttributes)

设置外部文件属性。

参数
externalFileAttributes long

setExtraFieldLength

public void setExtraFieldLength (int extraFieldLength)

设置额外字段的长度。

参数
extraFieldLength int

setFileCommentLength

public void setFileCommentLength (int fileCommentLength)

设置文件评论长度。

参数
fileCommentLength int

setFileName

public void setFileName (String fileName)

设置包含相对路径的文件名。

参数
fileName String

setFileNameLength(设置文件名称长度)

public void setFileNameLength (int fileNameLength)

设置文件名长度。

参数
fileNameLength int

setInternalFileAttributes

public void setInternalFileAttributes (int internalFileAttributes)

设置内部文件属性。

参数
internalFileAttributes int

setLocalHeaderOffset

public void setLocalHeaderOffset (long localHeaderOffset)

设置本地文件标头条目的偏移量。

参数
localHeaderOffset long

setUncompressedSize(压缩大小)

public void setUncompressedSize (long uncompressedSize)

设置未压缩的大小。

参数
uncompressedSize long

toString

public String toString ()

返回
String