本文整理汇总了Java中net.lingala.zip4j.model.FileHeader.getUncompressedSize方法的典型用法代码示例。如果您正苦于以下问题:Java FileHeader.getUncompressedSize方法的具体用法?Java FileHeader.getUncompressedSize怎么用?Java FileHeader.getUncompressedSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.lingala.zip4j.model.FileHeader
的用法示例。
在下文中一共展示了FileHeader.getUncompressedSize方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getZipFileInputStream
import net.lingala.zip4j.model.FileHeader; //导入方法依赖的package包/类
public BBBEZipEntry getZipFileInputStream(String zipEntry) {
try {
// Get the list of file headers from the zip file
@SuppressWarnings("rawtypes")
List fileHeaderList = mZipFile.getFileHeaders();
// Loop through the file headers
for (int i = 0; i < fileHeaderList.size(); i++) {
FileHeader fileHeader = (FileHeader) fileHeaderList.get(i);
String name = fileHeader.getFileName();
// System.out.println("name " + name);
if (name.equals(zipEntry)) {
return new BBBEZipEntry(mZipFile.getInputStream(fileHeader), fileHeader.getUncompressedSize());
}
}
} catch (ZipException e) {
e.printStackTrace();
}
return null;
}
示例2: getUnzippedFileSize
import net.lingala.zip4j.model.FileHeader; //导入方法依赖的package包/类
/**
*
* @param filename of the zip (including ext.)
* @return integer, total unpacked size of all the files that are in the zipfile
*/
public static int getUnzippedFileSize(String fileName)
{
int size = 0;
try
{
ZipFile zipfile = new ZipFile(fileName);
List<FileHeader> headers = zipfile.getFileHeaders();
for(FileHeader header : headers)
{
size += header.getUncompressedSize();
}
}
catch(Exception e)
{
Log.error("Error inspecting zip file "+fileName);
}
return size;
}
示例3: getZipArchiveInfo
import net.lingala.zip4j.model.FileHeader; //导入方法依赖的package包/类
public static ZipArchiveInfo getZipArchiveInfo(File zipFile) throws IOException {
try {
ZipFile internalZipFile = new ZipFile(zipFile);
long totalSize = 0;
long entryCount = 0;
for (Object fileHeader : internalZipFile.getFileHeaders()) {
FileHeader entry = (FileHeader) fileHeader;
long size = entry.getUncompressedSize();
if (size > 0L) {
totalSize += size;
}
++entryCount;
}
return new ZipArchiveInfo(totalSize, entryCount);
} catch (ZipException e) {
throw new IOException("Can't get ZIP-archive info.", e);
}
}