CentralDirectoryInfo

public final class CentralDirectoryInfo
extends Object

java.lang.Object
   ↳ com.android.tradefed.util.zip.CentralDirectoryInfo


CentralDirectoryInfo is a class containing the information of a file/folder inside a zip file.

Overall zipfile format: [Local file header + Compressed data [+ Extended local header]?]* [Central directory]* [End of central directory record]

Refer to following link for more details: https://en.wikipedia.org/wiki/Zip_(file_format)

Summary

Public constructors

CentralDirectoryInfo(byte[] data, int startOffset)

Constructor to collect the information of a file entry inside zip file.

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

Constructor to collect the information of a file entry inside zip file.

Protected constructors

CentralDirectoryInfo()

Default constructor used for unit test.

Public methods

boolean equals(Object o)
int getCompressedSize()

Get the compressed size.

int getCompressionMethod()

Get the compression method.

long getCrc()

Get the CRC of the file.

long getExternalFileAttributes()

Get the external file attributes.

int getExtraFieldLength()

Get the extra field length.

int getFileCommentLength()

Get the file comment length.

String getFileName()

Get the file name including the relative path.

int getFileNameLength()

Get the file name length.

int getFilePermission()

Get the Linux file permission, stored in the last 9 bits of external file attributes.

int getInfoSize()

Get the size of the central directory entry.

int getInternalFileAttributes()

Get the internal file attributes.

long getLocalHeaderOffset()

Get the offset of local file header entry.

long getUncompressedSize()

Get the uncompressed size.

int hashCode()
boolean isSymLink()

Checks if this is a symlink.

void setCompressedSize(long compressionSize)

Set the compressed size.

void setCompressionMethod(int compressionMethod)

Set the compression method.

void setCrc(long crc)

Set the CRC of the file.

void setExternalFileAttributes(long externalFileAttributes)

Set the external file attributes.

void setExtraFieldLength(int extraFieldLength)

Set the extra field length.

void setFileCommentLength(int fileCommentLength)

Set the file comment length.

void setFileName(String fileName)

Set the file name including the relative path.

void setFileNameLength(int fileNameLength)

Set the file name length.

void setInternalFileAttributes(int internalFileAttributes)

Set the internal file attributes.

void setLocalHeaderOffset(long localHeaderOffset)

Set the offset of local file header entry.

void setUncompressedSize(long uncompressedSize)

Set the uncompressed size.

String toString()

Public constructors

CentralDirectoryInfo

public CentralDirectoryInfo (byte[] data, 
                int startOffset)

Constructor to collect the information of a file entry inside zip file.

Parameters
data byte: byte[] of data that contains the information of a file entry.

startOffset int: start offset of the information block.

Throws
IOException

CentralDirectoryInfo

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

Constructor to collect the information of a file entry inside zip file.

Parameters
data byte: byte[] of data that contains the information of a file entry.

startOffset int: start offset of the information block.

useZip64 boolean: a boolean to support zip64 format in partial download.

Throws
IOException

Protected constructors

CentralDirectoryInfo

protected CentralDirectoryInfo ()

Default constructor used for unit test.

Public methods

equals

public boolean equals (Object o)

Parameters
o Object

Returns
boolean

getCompressedSize

public int getCompressedSize ()

Get the compressed size.

Returns
int

getCompressionMethod

public int getCompressionMethod ()

Get the compression method.

Returns
int

getCrc

public long getCrc ()

Get the CRC of the file.

Returns
long

getExternalFileAttributes

public long getExternalFileAttributes ()

Get the external file attributes.

Returns
long

getExtraFieldLength

public int getExtraFieldLength ()

Get the extra field length.

Returns
int

getFileCommentLength

public int getFileCommentLength ()

Get the file comment length.

Returns
int

getFileName

public String getFileName ()

Get the file name including the relative path.

Returns
String

getFileNameLength

public int getFileNameLength ()

Get the file name length.

Returns
int

getFilePermission

public int getFilePermission ()

Get the Linux file permission, stored in the last 9 bits of external file attributes.

Returns
int

getInfoSize

public int getInfoSize ()

Get the size of the central directory entry.

Returns
int

getInternalFileAttributes

public int getInternalFileAttributes ()

Get the internal file attributes.

Returns
int

getLocalHeaderOffset

public long getLocalHeaderOffset ()

Get the offset of local file header entry.

Returns
long

getUncompressedSize

public long getUncompressedSize ()

Get the uncompressed size.

Returns
long

hashCode

public int hashCode ()

Returns
int

isSymLink

public boolean isSymLink ()

Checks if this is a symlink.

Returns
boolean

setCompressedSize

public void setCompressedSize (long compressionSize)

Set the compressed size.

Parameters
compressionSize long

setCompressionMethod

public void setCompressionMethod (int compressionMethod)

Set the compression method.

Parameters
compressionMethod int

setCrc

public void setCrc (long crc)

Set the CRC of the file.

Parameters
crc long

setExternalFileAttributes

public void setExternalFileAttributes (long externalFileAttributes)

Set the external file attributes.

Parameters
externalFileAttributes long

setExtraFieldLength

public void setExtraFieldLength (int extraFieldLength)

Set the extra field length.

Parameters
extraFieldLength int

setFileCommentLength

public void setFileCommentLength (int fileCommentLength)

Set the file comment length.

Parameters
fileCommentLength int

setFileName

public void setFileName (String fileName)

Set the file name including the relative path.

Parameters
fileName String

setFileNameLength

public void setFileNameLength (int fileNameLength)

Set the file name length.

Parameters
fileNameLength int

setInternalFileAttributes

public void setInternalFileAttributes (int internalFileAttributes)

Set the internal file attributes.

Parameters
internalFileAttributes int

setLocalHeaderOffset

public void setLocalHeaderOffset (long localHeaderOffset)

Set the offset of local file header entry.

Parameters
localHeaderOffset long

setUncompressedSize

public void setUncompressedSize (long uncompressedSize)

Set the uncompressed size.

Parameters
uncompressedSize long

toString

public String toString ()

Returns
String