- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中net.lingala.zip4j.model.ZipModel
类的一些代码示例,展示了ZipModel
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZipModel
类的具体详情如下:
包路径:net.lingala.zip4j.model.ZipModel
类名称:ZipModel
暂无
代码示例来源:origin: com.github.axet/zip4j
private void initZipModel(ZipModel zipModel) {
if (zipModel == null) {
this.zipModel = new ZipModel();
} else {
this.zipModel = zipModel;
}
if (this.zipModel.getEndCentralDirRecord() == null)
this.zipModel.setEndCentralDirRecord(new EndCentralDirRecord());
if (this.zipModel.getCentralDirectory() == null)
this.zipModel.setCentralDirectory(new CentralDirectory());
if (this.zipModel.getCentralDirectory().getFileHeaders() == null)
this.zipModel.getCentralDirectory().setFileHeaders(new ArrayList());
if (this.zipModel.getLocalFileHeaderList() == null)
this.zipModel.setLocalFileHeaderList(new ArrayList());
if (this.outputStream instanceof SplitOutputStream) {
if (((SplitOutputStream)outputStream).isSplitZipFile()) {
this.zipModel.setSplitArchive(true);
this.zipModel.setSplitLength(((SplitOutputStream)outputStream).getSplitLength());
}
}
this.zipModel.getEndCentralDirRecord().setSignature(InternalZipConstants.ENDSIG);
}
代码示例来源:origin: net.lingala.zip4j/zip4j
int currSplitFileCounter = 0;
if (outputStream instanceof SplitOutputStream) {
zipModel.getEndCentralDirRecord().setOffsetOfStartOfCentralDir(
((SplitOutputStream)outputStream).getFilePointer());
currSplitFileCounter = ((SplitOutputStream)outputStream).getCurrSplitFileCounter();
if (zipModel.isZip64Format()) {
if (zipModel.getZip64EndCentralDirRecord() == null) {
zipModel.setZip64EndCentralDirRecord(new Zip64EndCentralDirRecord());
if (zipModel.getZip64EndCentralDirLocator() == null) {
zipModel.setZip64EndCentralDirLocator(new Zip64EndCentralDirLocator());
zipModel.getZip64EndCentralDirLocator().setNoOfDiskStartOfZip64EndOfCentralDirRec(currSplitFileCounter);
zipModel.getZip64EndCentralDirLocator().setTotNumberOfDiscs(currSplitFileCounter + 1);
zipModel.getEndCentralDirRecord().setNoOfThisDisk(currSplitFileCounter);
zipModel.getEndCentralDirRecord().setNoOfThisDiskStartOfCentralDir(currSplitFileCounter);
} catch (IOException e) {
throw new ZipException(e);
代码示例来源:origin: net.lingala.zip4j/zip4j
private long calculateTotalWorkForMergeOp(ZipModel zipModel) throws ZipException {
long totSize = 0;
if (zipModel.isSplitArchive()) {
int totNoOfSplitFiles = zipModel.getEndCentralDirRecord().getNoOfThisDisk();
String partFile = null;
String curZipFile = zipModel.getZipFile();
int partNumber = 0;
for (int i = 0; i <= totNoOfSplitFiles; i++) {
if (partNumber == zipModel.getEndCentralDirRecord().getNoOfThisDisk()) {
partFile = zipModel.getZipFile();
} else {
if (partNumber >= 9) {
partFile = curZipFile.substring(0, curZipFile.lastIndexOf(".")) + ".z" + (partNumber+ 1);
} else{
partFile = curZipFile.substring(0, curZipFile.lastIndexOf(".")) + ".z0" + (partNumber+ 1);
}
}
totSize += Zip4jUtil.getFileLengh(new File(partFile));
}
}
return totSize;
}
}
代码示例来源:origin: net.lingala.zip4j/zip4j
/**
* Creates a new instance of zip model
* @throws ZipException
*/
private void createNewZipModel() {
zipModel = new ZipModel();
zipModel.setZipFile(file);
zipModel.setFileNameCharset(fileNameCharset);
}
代码示例来源:origin: com.github.axet/zip4j
zipModel = new ZipModel();
zipModel.setFileNameCharset(fileNameCharset);
zipModel.setEndCentralDirRecord(readEndOfCentralDirectoryRecord());
zipModel.setZip64EndCentralDirLocator(readZip64EndCentralDirLocator());
if (zipModel.isZip64Format()) {
zipModel.setZip64EndCentralDirRecord(readZip64EndCentralDirRec());
if(zipModel.getZip64EndCentralDirRecord() != null &&
zipModel.getZip64EndCentralDirRecord().getNoOfThisDisk() > 0){
zipModel.setSplitArchive(true);
} else {
zipModel.setSplitArchive(false);
zipModel.setCentralDirectory(readCentralDirectory());
代码示例来源:origin: net.lingala.zip4j/zip4j
if (zipModel.isSplitArchive()) {
throw new ZipException("This is a split archive. Zip file format does not allow updating split/spanned files");
tmpZipFileName = zipModel.getZipFile() + currTime%1000;
File tmpFile = new File(tmpZipFileName);
tmpZipFileName = zipModel.getZipFile() + currTime%1000;
tmpFile = new File(tmpZipFileName);
zipFile = new File(zipModel.getZipFile());
long offsetStartCentralDir = zipModel.getEndCentralDirRecord().getOffsetOfStartOfCentralDir();
if (zipModel.isZip64Format()) {
if (zipModel.getZip64EndCentralDirRecord() != null) {
offsetStartCentralDir = zipModel.getZip64EndCentralDirRecord().getOffsetStartCenDirWRTStartDiskNo();
ArrayList fileHeaderList = zipModel.getCentralDirectory().getFileHeaders();
if (zipModel.getCentralDirectory().getFileHeaders().size() > 1) {
zipModel.getEndCentralDirRecord().setOffsetOfStartOfCentralDir(((SplitOutputStream)outputStream).getFilePointer());
zipModel.getEndCentralDirRecord().setTotNoOfEntriesInCentralDir(
zipModel.getEndCentralDirRecord().getTotNoOfEntriesInCentralDir() - 1);
zipModel.getEndCentralDirRecord().setTotNoOfEntriesInCentralDirOnThisDisk(
zipModel.getEndCentralDirRecord().getTotNoOfEntriesInCentralDirOnThisDisk() - 1);
zipModel.getCentralDirectory().getFileHeaders().remove(indexOfFileHeader);
for (int i = indexOfFileHeader; i < zipModel.getCentralDirectory().getFileHeaders().size(); i++) {
代码示例来源:origin: net.lingala.zip4j/zip4j
if (zipModel.getCentralDirectory() != null &&
zipModel.getCentralDirectory().getFileHeaders() != null &&
zipModel.getCentralDirectory().getFileHeaders().size() > 0) {
Raw.writeShortLittleEndian(shortByte, 0,
(short)((FileHeader)zipModel.getCentralDirectory().getFileHeaders().get(0)).getVersionMadeBy());
copyByteArrayToArrayList(shortByte, headerBytesList);
(short)((FileHeader)zipModel.getCentralDirectory().getFileHeaders().get(0)).getVersionNeededToExtract());
copyByteArrayToArrayList(shortByte, headerBytesList);
} else {
Raw.writeIntLittleEndian(intByte, 0, zipModel.getEndCentralDirRecord().getNoOfThisDisk());
copyByteArrayToArrayList(intByte, headerBytesList);
Raw.writeIntLittleEndian(intByte, 0, zipModel.getEndCentralDirRecord().getNoOfThisDiskStartOfCentralDir());
copyByteArrayToArrayList(intByte, headerBytesList);
if (zipModel.getCentralDirectory() == null ||
zipModel.getCentralDirectory().getFileHeaders() == null) {
throw new ZipException("invalid central directory/file headers, " +
"cannot write end of central directory record");
} else {
numEntries = zipModel.getCentralDirectory().getFileHeaders().size();
if (zipModel.isSplitArchive()) {
countNumberOfFileHeaderEntriesOnDisk(zipModel.getCentralDirectory().getFileHeaders(),
zipModel.getEndCentralDirRecord().getNoOfThisDisk());
} else {
numEntriesOnThisDisk = numEntries;
代码示例来源:origin: net.lingala.zip4j/zip4j
zipModel.getEndCentralDirRecord().setComment(encodedComment);
zipModel.getEndCentralDirRecord().setCommentBytes(commentBytes);
zipModel.getEndCentralDirRecord().setCommentLength(commentLength);
outputStream = new SplitOutputStream(zipModel.getZipFile());
if (zipModel.isZip64Format()) {
outputStream.seek(zipModel.getZip64EndCentralDirRecord().getOffsetStartCenDirWRTStartDiskNo());
} else {
outputStream.seek(zipModel.getEndCentralDirRecord().getOffsetOfStartOfCentralDir());
代码示例来源:origin: net.lingala.zip4j/zip4j
if (!zipModel.isSplitArchive()) {
ZipException e = new ZipException("archive not a split zip file");
progressMonitor.endProgressMonitorError(e);
try {
int totNoOfSplitFiles = zipModel.getEndCentralDirRecord().getNoOfThisDisk();
if (zipModel.getCentralDirectory() != null &&
zipModel.getCentralDirectory().getFileHeaders() != null &&
zipModel.getCentralDirectory().getFileHeaders().size() > 0) {
byte[] buff = new byte[4];
inputStream.seek(0);
end = new Long(zipModel.getEndCentralDirRecord().getOffsetOfStartOfCentralDir());
ZipModel newZipModel = (ZipModel)zipModel.clone();
newZipModel.getEndCentralDirRecord().setOffsetOfStartOfCentralDir(totBytesWritten);
代码示例来源:origin: net.lingala.zip4j/zip4j
if (zipModel.getEndCentralDirRecord() == null) {
zipModel.setEndCentralDirRecord(createEndOfCentralDirectoryRecord());
boolean isZipFileAlreadExists = Zip4jUtil.checkFileExists(zipModel.getZipFile());
SplitOutputStream splitOutputStream = new SplitOutputStream(new File(zipModel.getZipFile()), zipModel.getSplitLength());
outputStream = new ZipOutputStream(splitOutputStream, this.zipModel);
if (zipModel.getEndCentralDirRecord() == null) {
throw new ZipException("invalid end of central directory record");
splitOutputStream.seek(zipModel.getEndCentralDirRecord().getOffsetOfStartOfCentralDir());
代码示例来源:origin: net.lingala.zip4j/zip4j
if (zipModel.getEndCentralDirRecord() == null) {
throw new ZipException("EndCentralRecord was null, maybe a corrupt zip file");
ArrayList fileHeaderList = new ArrayList();
EndCentralDirRecord endCentralDirRecord = zipModel.getEndCentralDirRecord();
long offSetStartCentralDir = endCentralDirRecord.getOffsetOfStartOfCentralDir();
int centralDirEntryCount = endCentralDirRecord.getTotNoOfEntriesInCentralDir();
if (zipModel.isZip64Format()) {
offSetStartCentralDir = zipModel.getZip64EndCentralDirRecord().getOffsetStartCenDirWRTStartDiskNo();
centralDirEntryCount = (int)zipModel.getZip64EndCentralDirRecord().getTotNoOfEntriesInCentralDir();
if (Zip4jUtil.isStringNotNullAndNotEmpty(zipModel.getFileNameCharset())) {
fileName = new String(fileNameBuf, zipModel.getFileNameCharset());
} else {
fileName = Zip4jUtil.decodeFileName(fileNameBuf, fileHeader.isFileNameUTF8Encoded());
代码示例来源:origin: net.lingala.zip4j/zip4j
/**
* Returns the list of file headers in the zip file. Throws an exception if the
* zip file does not exist
* @return list of file headers
* @throws ZipException
*/
public List getFileHeaders() throws ZipException {
readZipInfo();
if (zipModel == null || zipModel.getCentralDirectory() == null) {
return null;
}
return zipModel.getCentralDirectory().getFileHeaders();
}
代码示例来源:origin: net.lingala.zip4j/zip4j
checkParameters(parameters);
boolean isZipFileAlreadExists = Zip4jUtil.checkFileExists(zipModel.getZipFile());
SplitOutputStream splitOutputStream = new SplitOutputStream(new File(zipModel.getZipFile()), zipModel.getSplitLength());
outputStream = new ZipOutputStream(splitOutputStream, this.zipModel);
if (zipModel.getEndCentralDirRecord() == null) {
throw new ZipException("invalid end of central directory record");
splitOutputStream.seek(zipModel.getEndCentralDirRecord().getOffsetOfStartOfCentralDir());
代码示例来源:origin: net.lingala.zip4j/zip4j
public RandomAccessFile startNextSplitFile() throws IOException, FileNotFoundException {
String currZipFile = zipModel.getZipFile();
String partFile = null;
if (currSplitFileCounter == zipModel.getEndCentralDirRecord().getNoOfThisDisk()) {
partFile = zipModel.getZipFile();
} else {
if (currSplitFileCounter >= 9) {
partFile = currZipFile.substring(0, currZipFile.lastIndexOf(".")) + ".z" + (currSplitFileCounter + 1);
} else {
partFile = currZipFile.substring(0, currZipFile.lastIndexOf(".")) + ".z0" + (currSplitFileCounter + 1);
}
}
currSplitFileCounter++;
try {
if(!Zip4jUtil.checkFileExists(partFile)) {
throw new IOException("zip split file does not exist: " + partFile);
}
} catch (ZipException e) {
throw new IOException(e.getMessage());
}
return new RandomAccessFile(partFile, InternalZipConstants.READ_MODE);
}
代码示例来源:origin: net.lingala.zip4j/zip4j
zipModel.setZip64Format(true);
writingZip64Rec = true;
localFileHeader.setWriteComprSizeInZip64ExtraRecord(true);
if (Zip4jUtil.isStringNotNullAndNotEmpty(zipModel.getFileNameCharset())) {
byte[] fileNameBytes = localFileHeader.getFileName().getBytes(zipModel.getFileNameCharset());
copyByteArrayToArrayList(fileNameBytes, byteArrayList);
} else {
代码示例来源:origin: net.lingala.zip4j/zip4j
private RandomAccessFile createFileHandler(ZipModel zipModel, String mode) throws ZipException {
if (zipModel == null || !Zip4jUtil.isStringNotNullAndNotEmpty(zipModel.getZipFile())) {
throw new ZipException("input parameter is null in getFilePointer, cannot create file handler to remove file");
}
try {
return new RandomAccessFile(new File(zipModel.getZipFile()), mode);
} catch (FileNotFoundException e) {
throw new ZipException(e);
}
}
代码示例来源:origin: net.lingala.zip4j/zip4j
private RandomAccessFile createFileHandler(String mode) throws ZipException {
if (this.zipModel == null || !Zip4jUtil.isStringNotNullAndNotEmpty(this.zipModel.getZipFile())) {
throw new ZipException("input parameter is null in getFilePointer");
}
try {
RandomAccessFile raf = null;
if (zipModel.isSplitArchive()) {
raf = checkSplitFile();
} else {
raf = new RandomAccessFile(new File(this.zipModel.getZipFile()), mode);
}
return raf;
} catch (FileNotFoundException e) {
throw new ZipException(e);
} catch (Exception e) {
throw new ZipException(e);
}
}
代码示例来源:origin: net.lingala.zip4j/zip4j
private void updateSplitZip64EndCentralDirRec(ZipModel zipModel, ArrayList fileSizeList) throws ZipException {
if (zipModel == null) {
throw new ZipException("zip model is null, cannot update split Zip64 end of central directory record");
}
if (zipModel.getZip64EndCentralDirRecord() == null) {
return;
}
zipModel.getZip64EndCentralDirRecord().setNoOfThisDisk(0);
zipModel.getZip64EndCentralDirRecord().setNoOfThisDiskStartOfCentralDir(0);
zipModel.getZip64EndCentralDirRecord().setTotNoOfEntriesInCentralDirOnThisDisk(
zipModel.getEndCentralDirRecord().getTotNoOfEntriesInCentralDir());
long offsetStartCenDirWRTStartDiskNo = 0;
for (int i = 0; i < fileSizeList.size(); i++) {
offsetStartCenDirWRTStartDiskNo += ((Long)fileSizeList.get(i)).longValue();
}
zipModel.getZip64EndCentralDirRecord().setOffsetStartCenDirWRTStartDiskNo(
((Zip64EndCentralDirRecord)zipModel.getZip64EndCentralDirRecord()).getOffsetStartCenDirWRTStartDiskNo() +
offsetStartCenDirWRTStartDiskNo);
}
代码示例来源:origin: net.lingala.zip4j/zip4j
private void updateSplitEndCentralDirectory(ZipModel zipModel) throws ZipException {
try {
if (zipModel == null) {
throw new ZipException("zip model is null - cannot update end of central directory for split zip model");
}
if (zipModel.getCentralDirectory()== null) {
throw new ZipException("corrupt zip model - getCentralDirectory, cannot update split zip model");
}
zipModel.getEndCentralDirRecord().setNoOfThisDisk(0);
zipModel.getEndCentralDirRecord().setNoOfThisDiskStartOfCentralDir(0);
zipModel.getEndCentralDirRecord().setTotNoOfEntriesInCentralDir(
zipModel.getCentralDirectory().getFileHeaders().size());
zipModel.getEndCentralDirRecord().setTotNoOfEntriesInCentralDirOnThisDisk(
zipModel.getCentralDirectory().getFileHeaders().size());
} catch (ZipException e) {
throw e;
} catch (Exception e) {
throw new ZipException(e);
}
}
代码示例来源:origin: net.lingala.zip4j/zip4j
if (zipModel.getCentralDirectory() != null &&
zipModel.getCentralDirectory().getFileHeaders() != null &&
zipModel.getCentralDirectory().getFileHeaders().size() > 0) {
String relativeFileName = Zip4jUtil.getRelativeFileName(
((File)fileList.get(i)).getAbsolutePath(), parameters.getRootFolderInZip(), parameters.getDefaultFolderPath());
FileHeader fileHeader = Zip4jUtil.getFileHeader(zipModel, relativeFileName);
if (fileHeader != null) {
totalWork += (Zip4jUtil.getFileLengh(new File(zipModel.getZipFile())) - fileHeader.getCompressedSize());
我尝试理解[c代码 -> 汇编]代码 void node::Check( data & _data1, vector& _data2) { -> push ebp -> mov ebp,esp ->
我需要在当前表单(代码)的上下文中运行文本文件中的代码。其中一项要求是让代码创建新控件并将其添加到当前窗体。 例如,在Form1.cs中: using System.Windows.Forms; ..
我有此 C++ 代码并将其转换为 C# (.net Framework 4) 代码。有没有人给我一些关于 malloc、free 和 sprintf 方法的提示? int monate = ee; d
我的网络服务器代码有问题 #include #include #include #include #include #include #include int
给定以下 html 代码,将列表中的第三个元素(即“美丽”一词)以斜体显示的 CSS 代码是什么?当然,我可以给这个元素一个 id 或一个 class,但 html 代码必须保持不变。谢谢
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 我们不允许提问寻求书籍、工具、软件库等的推荐。您可以编辑问题,以便用事实和引用来回答。 关闭 7 年前。
我试图制作一个宏来避免重复代码和注释。 我试过这个: #define GrowOnPage(any Page, any Component) Component.Width := Page.Surfa
我正在尝试将我的旧 C++ 代码“翻译”成头条新闻所暗示的 C# 代码。问题是我是 C# 中的新手,并不是所有的东西都像 C++ 中那样。在 C++ 中这些解决方案运行良好,但在 C# 中只是不能。我
在 Windows 10 上工作,R 语言的格式化程序似乎没有在 Visual Studio Code 中完成它的工作。我试过R support for Visual Studio Code和 R-T
我正在处理一些报告(计数),我必须获取不同参数的计数。非常简单但乏味。 一个参数的示例查询: qCountsEmployee = ( "select count(*) from %s wher
最近几天我尝试从 d00m 调试网络错误。我开始用尽想法/线索,我希望其他 SO 用户拥有可能有用的宝贵经验。我希望能够提供所有相关信息,但我个人无法控制服务器环境。 整个事情始于用户注意到我们应用程
我有一个 app.js 文件,其中包含如下 dojo amd 模式代码: require(["dojo/dom", ..], function(dom){ dom.byId('someId').i
我对“-gencode”语句中的“code=sm_X”选项有点困惑。 一个例子:NVCC 编译器选项有什么作用 -gencode arch=compute_13,code=sm_13 嵌入库中? 只有
我为我的表格使用 X-editable 框架。 但是我有一些问题。 $(document).ready(function() { $('.access').editable({
我一直在通过本教程学习 flask/python http://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-i-hello-wo
我想将 Vim 和 EMACS 用于 CNC、G 代码和 M 代码。 Vim 或 EMACS 是否有任何语法或模式来处理这种类型的代码? 最佳答案 一些快速搜索使我找到了 this vim 和 thi
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 想改进这个问题?更新问题,使其成为 on-topic对于堆栈溢出。 7年前关闭。 Improve this
这个问题在这里已经有了答案: Enabling markdown highlighting in Vim (5 个回答) 6年前关闭。 当我在 Vim 中编辑包含 Markdown 代码的 READM
我正在 Swift3 iOS 中开发视频应用程序。基本上我必须将视频 Assets 和音频与淡入淡出效果合并为一个并将其保存到 iPhone 画廊。为此,我使用以下方法: private func d
pipeline { agent any stages { stage('Build') { steps { e
我是一名优秀的程序员,十分优秀!