TheCodersCorner.com items tagged with compression.
In the example below we build on the Reading a zip file from java using ZipInputStream page to provide basic filtering. This filtering is provided by the filteredExpandZipFile method taking a Predicate. Every ZipEntry is passed to the predicate, but only ones that match (predicate returns true) are included. Note that the size of an entry cannot be accurately determined in...
Following on from one of our popular articles on Reading a zip file from java using ZipInputStream we've put together a new article on how to create a zip archive using Java. The below example uses ZipOutputStream to create a zip file from all the items in a directory. Zip files are written slightly differently to a normal stream in that...
Another common compression file format on Linux is the GZIP format. Java again has out of the box support for this file format. Gzip files differ from zip files in that they only contain one file, the compressed form of the original file with a .gz extension. Java's takes such a file type and decompresses it. We can treat ...
Java provides support for reading zip files in the form of . This class provides an API where you can iterate over all the items in a given zip file, reading the data from the archive for each file. In order to do this, first you must create the instance giving the file that you wish to expand. Then you...