truezip

How to listfiles() from jar in a tar by using truezip in Java?

怎甘沉沦 提交于 2019-12-11 07:33:32
问题 I am trying to list all files in a tar, including files in jar. How can I do this by using truezip in Java or other api? Thanks 回答1: Using TrueZIP 7, you could use something like this: public static void main(String args[]) throws IOException { // Remember to set to add the following dependencies to the class path: // Compile time artifactId(s): truezip-file // Run time artifactId(s): truezip-kernel, truezip-driver-file, truezip-driver-tar, truezip-driver-zip TFile.setDefaultArchiveDetector

Exception running TrueZip

∥☆過路亽.° 提交于 2019-12-11 06:46:44
问题 I run a simple TrueZip code: TFile src = new TFile(path + file_to_add); TFile dst = new TFile(path + outZipFile); src.cp_rp(dst); When i run the program the compiler throws (on the first line): java.lang.NoClassDefFoundError: de/schlichtherle/truezip/fs/FsSyncOption I have truezip-file-7.4.3.jar and truezip-file-7.4.3-sources.jar files. Am i missing jars or the problem may be something else? 回答1: add truezip-driver-file.jar & truezip-kernel.jar according to Maven POM. 来源: https:/

How can you get the size of a file in an archive using TrueZip?

↘锁芯ラ 提交于 2019-12-02 15:56:34
问题 As per the TrueZip docs, it appears that the length() method returns 0 or -1. I am updating a WAR archive and I would like to only update files whose lengths have changed. How can this be achieved? Thanks in advance, Martin 回答1: First, call the method TFile.umount() to commit any changes. Then use the following method to obtain a TFile which does not detect the archive file and call its length() method: private static TFile newNonArchiveFile(TFile file) { return new TFile(file.getParentFile()

How can you get the size of a file in an archive using TrueZip?

倖福魔咒の 提交于 2019-12-02 12:27:20
As per the TrueZip docs, it appears that the length() method returns 0 or -1. I am updating a WAR archive and I would like to only update files whose lengths have changed. How can this be achieved? Thanks in advance, Martin Christian Schlichtherle First, call the method TFile.umount() to commit any changes. Then use the following method to obtain a TFile which does not detect the archive file and call its length() method: private static TFile newNonArchiveFile(TFile file) { return new TFile(file.getParentFile(), file.getName(), TArchiveDetector.NULL); } 来源: https://stackoverflow.com/questions

Java - Zipping existing files [duplicate]

若如初见. 提交于 2019-11-30 22:27:29
Possible Duplicate: Appending files to a zip file with Java Hello Java Developers, Here's the scenario: Say I have a textfile named sample.txt . What I actually want to do is to put the sample.txt file into a *.zip file named TextFiles.zip . Here's what I have learned so far. try{ File f = new File(compProperty.getZIP_OUTPUT_PATH()); zipOut = new ZipOutputStream(new FileOutputStream(f)); ZipEntry zipEntry = new ZipEntry("sample.txt"); zipOut.putNextEntry(zipEntry); zipOut.closeEntry(); zipOut.close(); System.out.println("Done"); } catch ( Exception e ){ // My catch block } My code so far

Java - Zipping existing files [duplicate]

大憨熊 提交于 2019-11-30 18:11:02
问题 This question already has answers here : Closed 6 years ago . Possible Duplicate: Appending files to a zip file with Java Hello Java Developers, Here's the scenario: Say I have a textfile named sample.txt . What I actually want to do is to put the sample.txt file into a *.zip file named TextFiles.zip . Here's what I have learned so far. try{ File f = new File(compProperty.getZIP_OUTPUT_PATH()); zipOut = new ZipOutputStream(new FileOutputStream(f)); ZipEntry zipEntry = new ZipEntry("sample.txt

Appending files to a zip file with Java

旧城冷巷雨未停 提交于 2019-11-26 01:29:48
问题 I am currently extracting the contents of a war file and then adding some new files to the directory structure and then creating a new war file. This is all done programatically from Java - but I am wondering if it wouldn\'t be more efficient to copy the war file and then just append the files - then I wouldn\'t have to wait so long as the war expands and then has to be compressed again. I can\'t seem to find a way to do this in the documentation though or any online examples. Anyone can give