Using Java to implement compression/decompression (can solve Chinese garbled)

Source: Internet
Author: User

This method can handle the case that the file name contains Chinese, the contents of the document contain Chinese (test environment: Win8-chinese), the code is very short, reserved for later use

Using the Ant.jar package, you need to download and import the project can be used ( this package is), download completed in the inside found Ant.jar package directly copied out and imported

import;import;import;import;import;class ZipUtil {private static final         Project Default_project = new Project ();        public static void UnZip (file orgin, file dest) {Expand Expand = new Expand ();        Expand.setproject (Default_project);        EXPAND.SETSRC (Orgin);        Expand.setdest (dest);    Expand.execute ();        public static void Zip (file orgin, file dest) {Zip zip = new zip ();        Zip.setproject (Default_project);                 Zip.setdestfile (dest);        Fileset fs = new Fileset ();        Fs.setproject (Default_project);                 Fs.setdir (orgin);//Fs.setincludes ("**/*.java");//Fs.setexcludes ("**/*.xml");        Zip.addfileset (FS);    Zip.execute (); }}

Using Java to implement compression/decompression (can solve Chinese garbled)

Related Article

Contact Us

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: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.