Monday, June 9, 2008

Extract zip file with Java

File file = new File("c:/test.zip");
BufferedOutputStream dest = null;
BufferedInputStream is = null;
ZipEntry entry;
ZipFile zipfile = new ZipFile(file);
Enumeration e = zipfile.entries();
while (e.hasMoreElements()) {
entry = (ZipEntry) e.nextElement();
System.out.println("Extracting: " + entry);
is = new BufferedInputStream(zipfile.getInputStream(entry));
int count;
byte data[] = new byte[BUFFER];
String fileName = "c:/" + entry.getName();
File outFile = new File(fileName);
if (entry.isDirectory()) {
outFile.mkdirs();
System.out.println("Create Folder " + outFile);
} else {
FileOutputStream fos = new FileOutputStream(outFile);
dest = new BufferedOutputStream(fos, BUFFER);
while ((count = is.read(data, 0, BUFFER)) != -1){
dest.write(data, 0, count);
}
dest.flush();
dest.close();
is.close();
}
}

7 comments:

Nuzly said...

thanks bro

Alexis said...

Obviously in the world there tool which better than winzip,and to my mind this is next application-zip file check,it is better works with zip files and it resources wider as far as I can see than winzip,also it has free status as how as I remember,software permits to repair corrupted archives with *.zip extension,solve errors on example-CRC error and Cannot open file: it does not appear to be a valid archive,program for check repair zip file and check integrity of zip file uses several different algorithms for crc check fix zip file and data recovery, that is why, the process will take some time, according to CPU performance and file size,program will work under all supported versions of this operating system,will keep initial structure of your archive as well as original names of files and directories,check repair zip file can check why zip file is corrupted and work with password protected archives, but you should know this password.

Alex said...

I know a lot of tools,which works with other type of files. But yesterday I had a problem with my zip files and I couldn't keep in mind no one of it. Fortunately I called a friend-programmer up and he recommended this application - winzip fixer. It solved my situation for minutes and free of charge as far as I remember. I hazard the remark that the tool helped my sister too and she thanked me.

Anonymous said...

emuffepsimbus
[url=http://healthplusrx.com/south-beach-diet-reviews]south beach diet reviews[/url]
Agelsorgo

Anonymous said...

Every weekend i used to go to see this web page, as i want enjoyment, as this this website conations actually fastidious funny data too.
My page :: christian louboutin website

Anonymous said...

whoah this blog is wonderful i really like studying your
articles. Keep up the good work! You understand, lots
of persons are looking around for this information, you could help them greatly.
Here is my web page - nike free run

Software Selling FastPro said...

Software Sale Point (SSP)
Software Sale©point™

Email : softwarelinked23@yahoo.com
Email : softwarelinked@gmail.com

Web : http://softwarelinked.blogspot.com/
web : http://softwarelinked.wordpress.com/
web : http://softwarelinked.page.tl/
Web : http://softwarelinked2000.blogspot.com/

>>> https://www.youtube.com/watch?v=YwSYylIa4TI
>>> https://www.youtube.com/watch?feature=player_embedded&v=osNATarxUmQ
>>> https://www.youtube.com/watch?feature=player_embedded&v=Ko7_HYVQZ-c
>>> https://www.youtube.com/watch?feature=player_embedded&v=D6udtKNknsk
>>> https://www.youtube.com/watch? >>>http://softwarelinked.blogspot.com/2014/07/comelz-caligola-v4117-download-with.html
>>>http://softwarelinked.blogspot.com/2014/07/midas-civil-2014-v23-serial-download.html
>>>http://softwarelinked.blogspot.com/2014/07/adapt-floor-pro-v2010-through-v2012.html
>>>http://softwarelinked.blogspot.com/2014/07/grl-weap-crackkeygen-full-version.html
>>>http://softwarelinked.blogspot.com/2011/05/sema-experience-v11-usb-dongle-crack.html
>>>http://softwarelinked.blogspot.com/2014/09/cad-autopol-sigma-2010-is-available.html
>>>http://softwarelinked.blogspot.com/2014/09/wilcom-e2-is-available-for-download.html
>>>http://softwarelinked.blogspot.com/2014/09/chief-architect-premier-x6-162047.html
>>>http://softwarelinked.blogspot.com/2014/10/autoship-10-autohydro-640-autopower-32.html
>>>http://softwarelinked2000.blogspot.com/2014/10/latest-info-now-available-2013-ship.html

# Autoship 10 Autohydro 6.40 Autopower 3.2 Autoplate 10 Autoyacht 10 Full License
# Sigmatek Sigmanest v9.1 SP6.6 Download
# Cad AutoPol Sigma 2010 is available with usb key
# Schlumberger_Petrel_2013.2_crack/License Download
# Chief Architect Premier X6 16.2.0.47 Download Patch
# GeoMedia 2014 + GEOS Pro v 3.5 Emulator Download
# GRL WEAP Crack+Keygen Full Version Download
# ADAPT-Floor Pro v2010 through v2012 Build 1 Keygen Download
# Midas Civil 2014 v2.3 serial Download
# Midas Civil 2014(v2.2) KeyGen Download
# Gerber AccuMark 9.0.0.245 multilanguage Download
# Comelz CALIGOLA v4.11.7 Download with License File
# Wilcom E2 is Available For Download Permanent License File
# Tajima 14.1.6.5388 Full x32 x64
# Wings XP 5 Embroidery Software With Permanent License File
# OptiTex 12.2.50 with Nesting ++2 and pro
# Lectra Modaris Expert V7R2 + 3D Prototype + Full (7.2.55.0)
# Pixel Art Studio Download with Permanent License
# LightTools 8.1.0 Download with License File
# Lectra Diamino Expert V6R1 SP2\SP3 (6.1.2.7) + Marker Manager
# OrcaFlex 9.7c Download with Licens
# NedGraphics 2010 Collection Cracked/License
# Eat DesignScope victor 4.4.8