Public list<string> UnZip (string pathstring, String zippathstring) {
Long startTime = System.currenttimemillis ();
list<string> list = new arraylist<> ();
try {
Charset Charset = Charset.forname ("GBK");
Zipinputstream Zin = new Zipinputstream (New FileInputStream (
zippathstring), CharSet);//input source Zip path
Bufferedinputstream Bin = new Bufferedinputstream (Zin);
String Parent = pathstring; Output path (folder directory)
File Fout = null;
ZipEntry entry;
list list = new arraylist ();
try {
while ((entry = Zin.getnextentry ())! = NULL
&&!entry.isdirectory ()) {
String filenamestring = Entry.getname ();
List.add (filenamestring);
Fout = new File (Parent, filenamestring);
if (! Fout.exists ()) {
(New File (Fout.getparent ())). Mkdirs ();
}
FileOutputStream out = new FileOutputStream (Fout);
Bufferedoutputstream Bout = new Bufferedoutputstream (out);
int b;
while ((b = Bin.read ())! =-1) {
Bout.write (b);
}
Bout.close ();
Out.close ();
System.out.println (Fout + "decompression success");
}
Bin.close ();
Zin.close ();
} catch (IOException e) {
E.printstacktrace ();
}
} catch (FileNotFoundException e) {
E.printstacktrace ();
}
Long endTime = System.currenttimemillis ();
SYSTEM.OUT.PRINTLN ("Time Consuming:" + (Endtime-starttime) + "MS");
return list;
}
Java Unzip Chinese name problem