/* Link from: http://www.ibm.com/developerworks/cn/opensource/os-php-v524/
* Author profile: Tracy Peterson (tracy@tracypeterson.com), freelance writer, Consultant. From
* Since 1997, Tracy Peterson has been an IT project manager and Web developer.
*
Java implementation Zip decompression and compression is basically using the Java peptide and recursive technology, can be a single file and any Cascade folder compression and decompression, for some beginners is a good example.Zip plays archive and
A simple zip compression decompression Tool class written using Java base classes
Copy Code code as follows:
Package sun.net.helper;
Import java.io.*;Import Java.util.logging.Logger;Import java.util.zip.*;public class Ziputil {Private
Java implementation Zip decompression and compression is basically using the Java peptide and recursive technology, can be a single file and any Cascade folder compression and decompression, for some beginners is a good example.Zip plays archive and
Zip plays archive and compresses two roles; gzip does not archive files, only compresses individual files, so on UNIX platforms, command tar is typically used to create an archive file and then command gzip to compress the archive file.The Java I/O
The Java 1.1 Library with ZIP support appears more comprehensive. It makes it easy to save multiple files. There is even a separate class to simplify the read operation of the zip file. This library is a standard zip format, so it works well with
We all know that. zip-formatted compressed files are supported by default on Mac OS X, but sometimes when we open a zip file, it automatically becomes a. cpgz format file. If you open it again using the Archive tool, you will be able to recycle the
mac on the zip file to extract the CPGZ format of the file what to do?
Problem Reason:
First, we analyze the following reasons for this situation:
1, the zip file has been damaged;
2, zip file download did not download completely;
3, the
Java provides read and write data streams in a compressed format. They are encapsulated into out-of-the-box IO classes to provide compression capabilities. Let's start with the use of compressed files in Java.Directory Navigation:
A brief
Implementation of the Java decompression Technology GZIP ZIP BZIP2 Series implementationThere's nothing to say, it's all file operations, direct code placementPackage Com.ljh.zip;import Java.io.bufferedinputstream;import Java.io.bufferedoutputstream;
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.