views:

99

answers:

5

Where can I learn about text compression in Java?

What classes would be used, and how would I use them?

+4  A: 

java.util.zip?

Brabster
A: 

The Google results are very informative: http://java.sun.com/developer/technicalArticles/Programming/compression/

joeslice
+2  A: 

The java.util.zip package contains GZIPInputStream and GZipOutputStream, you can easily combine those with other java.io streams to do what you need.

skaffman
+1  A: 

Commons Codec provides some useful encoding/decoding classes as well.

matt b
A: 

Here's some example coding showing how to use Deflate, Filtered, bzip2, and lzma compression in Java. http://www.theeggeadventure.com/wikimedia/index.php/Java_Data_Compression

For most of the stream based classes, you add them inline with your existing Java IO methods. If you are reading or writing to a file, and can compress/uncompress by adding a filter to your stream. The same can be said for sockets and other IO.

brianegge