I am looking for a java library which can compress files and directories.
I need the following features
-compress
-decompress
-split archives to multiple files based on a size limit
I would really like the following features as well
-encrypt archives
-encrypt file names
I would prefer if the solution was a 7zip library but it's not required.
I know there is an lzma Java sdk but i'm not sure if it supports all the features above. I know it doesn't support encryption, but does it support splitting archives?
Any library supporting all the features above would be preferred.
Thanks.
How about the Deflater/Inflater classes mentioned in the question "What’s a good compression library for Java?".
I know the current interfaces proposed by Java are Stream-based, not "filename"-based, but according to the following article on Java compression.
TrueZip should be able to do most of what you need
Related
I need to rewrite some java 7 file IO code that should run on a Java 6 VM too.
The implementation uses handy Java 7 features like autoclosing, Paths and Files.
To be more specific, I need to handle expressions like /tmp/foo/*.bar to return all .bar files (currently implemented with Files.newDirectoryStream(dir, glob)).
Does anyone know a handy library for this?
The Apache Commons IO API is also a good choice. I used it for a similar work (rewrite some code from java7 to java6 that used Path object) and they work very well.
The Apache Ant API would be a good candidate for this, in particular their FileSet class might do the job.
guava runs on java6 and it has a nice I/O api.
I need to create some software which works with ZIP archives compressed with very old implode method.
Tried to write decompressor but nothing good happened. Optimized C-code is very hard for me.
Found this C-implementation (here) but cannot write it on Java. Just found request in Apache-commons about this feature (JIRA contatin link to APPNOTES.TXT with method description).
I should write cross-platform decompressor for this method.
Perfect is native-Java implementation.
Looking for help. Thanks.
Starting with the version 1.7 Apache Commons Compress can decompress imploded and shrunk zip entries. This is a pure Java implementation of the algorithm.
http://commons.apache.org/compress/
Did you try if TrueZip supports those older formats?
sevenzipjbinding - 7-Zip-JBinding is a java wrapper for 7-Zip C++ library. It allows extraction of many archive formats using a very fast native library directly from java through JNI.
We need a cross platform solution for compressing files. Our server runs on Windows XP/Vista/7 and 3 Unix distros, SunOS, HPUX, and AIX. Our server creates files that needed to be zipped before being set back to the client. Our initial thought was to compress the files with jar, as most of the servers have java installed, but apparently jar isn't included in the jre, just the jdk. Our server is written in C and the application that needs to create a compressed file is Perl.
I'd really like something I don't have install as our install base is LARGE and adding new required applications is generally difficult. Is there anything that is guaranteed to be built into each of those OSes that I could use for zipping? Even if I have to use something different for each, that would probably be okay also.
If you don't want to have to install anything you're pretty much SOL. Windows doesn't make this easy.
If you want to write something yourself java.util.zip is in the Java 2 Standard Edition (J2SE) and Perl has Archive::Zip
I do like 7-zip a lot but for situations like yours I always go to least-common denominataor: ZIP. Simple old ZIP. Most Unices and linuxes have zip and unzip. And for windows there are lots of options, including 7-zip, that can manipulate zip files. And probably the clients will have a zip client installed.
You could always consider distributing an open source compression tool or even using a compression SDK as part of your app such as 7 ZIP's
If you have Java installed (no matter JRE or JDK), you can use the pack200 and unpack200 to create and unpack the archives. Pack200 uses gzip compression which is pretty standard.
You should note that pack200 doesn't allow to compress multiple files in one archive (nature of gzip). If it's required, you can implement your own tool in pure Java that will create zip files and run anywhere with the unified command line interface (Java has built-in zip support, see some samples).
If you go that route, you can also use the native java implementation of bz2 or 7zip formats to get better compression.
Is there a free package for reading, manipulating and writing ASN.1 in Java?
It must be:
Free
Lightweight
Self-contained (without external dependencies on, e.g. Apache commons)
Java 5 (not Java 6), and Java 4 is preferred.
The following project looks promising:
http://www.chaosinmotion.com/wiki/index.php?title=ASN.1_Library
It is provided under a liberal BSD-style licence.
It is small, 41 classes compiling to 55KiB.
It compiled clean with no dependencies to Java 3.
The free BouncyCastle library provides low-level ASN.1 parsing. You don't need to install BC as a provider to use the ASN.1 capabilities. It has different versions for 1.4 and up. It has no external dependencies. As the default bundle contains all of the BC provider classes, you may want to repackage it if you want something more compact.
You could use jASN1. It is licensed under LGPL and should satisfy all of your needs. It is also very efficient.
I need to be able to parse any kind of ASN.1 data in krypt. Although krypt is a Ruby project, you may want to have a look at the JRuby extension - the code for handling ASN.1 parsing/encoding is written entirely in Java and modular enough for easy extraction.
I also made a Java-only version, but it is missing some of the higher-level functionality of the former. But since it's concise, maybe it's a good opportunity to get you started.
Both are free of any additional dependencies and use only standard JDK functionality.
I need an OpenSource API in Java, which can encode *.wav and *.au formats to MP3 and vice-versa.
I have evaluated Java Sound API and LameOnJ, but they do not meet my requirements and are not stable, respectively. Please suggest one that is free and platform independent.
There may not be an adequate answer for you, yet, as the MP3 format requires the authors of decoder/encoders to obtain a license from the Fraunhofer Institute.
I think the the LAME library is distributed from a country that does not respect these IP issues, but it took a considerably amount of legal hackery to get this far.
For any other libraries - for example one written in Java, the authors need to get a similar license. Where cost is an issue - e.g. in an Open Source project, then this is enough of a disincentive to starting.
For more details see this wikipedia article.
If LAME4J is not stable enough for you, then I'm afraid your options are probably:
wait for Sun to license the format for the core JRE. This, I believe they have done recently, but I don't know of any release dates (perhaps to do with JavaFX)
implement your own in Java, and pay the license. I wouldn't fancy this one, either.
write your own Java wrapper to LAME, via JNA, or SWIG
contribute to Lame4J.
pick another format. OGG and FLAC are quite good, and relatively well supported.
Is has been some time, but Oracle/Sun has released MP3 support for JMF. This can be downloaded from the following url:
http://www.oracle.com/technetwork/java/javase/tech/index-jsp-140239.html
Adding it to the classpath will enable playback via the AudioSystem api.
The LAME4J uses the free but time-limited license and the unlimited license will cost you some money.
I've found the Lamejb library on the SourceForge, which requires only the lame binaries and works well without any additional licensing.
Use the Process API to invoke SoX
SoX comes with source or as precompiled binaries for Windows and Mac.
If you are searching a pure java version of lame, check out these sources:
http://jsidplay2.cvs.sourceforge.net/viewvc/jsidplay2/jump3r/
The Jave2 project is Java library that wraps FFMPEG and provides most of its functionality* through a rather useful Java API.
Pros:
Useful Java API that is powerful and rather simple.
FFMPEG binary is bundled in, so you don't have to manage an FFMPEG installation on your system.
Cons:
Does not support streaming data: you have to work through temporary files: every conversion starts by storing all the content in some files on the system, getting FFMPEG to create new files for you, then reading them. This is not a deficiency in FFMPEG, more of a problem in Java where it is very hard to stream data to external processes**.
*) specifically around format conversion - the filter functionality is mostly not represented.
**) In Java, launching a process and connecting to its standard output and input is possible but not comfortable, and using named pipes (the BKM for piping AV to/from FFMPEG) is almost impossible, and even if you do manage to do that, Jave2 doesn't play well with that. I have a set of tools to workaround these problems, based on JNA, if anyone is intersted - I can share.