Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2016
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.23 KB | None | 0 0
  1. package javaapplication3;
  2.  
  3. import java.io.BufferedOutputStream;
  4. import java.io.FileInputStream;
  5. import java.io.FileNotFoundException;
  6. import java.io.FileOutputStream;
  7. import java.io.IOException;
  8. import java.util.zip.ZipEntry;
  9. import java.util.zip.ZipInputStream;
  10.  
  11.  
  12. public class JavaApplication3 {
  13.  
  14.  
  15. public static void main(String[] args) throws FileNotFoundException, IOException
  16. {
  17. FileInputStream in=null;
  18. ZipInputStream zin=null;
  19. ZipEntry z=null;
  20.  
  21. FileOutputStream out=null;
  22. BufferedOutputStream bout=null;
  23.  
  24. in=new FileInputStream("hamza.zip");
  25. zin=new ZipInputStream(in);
  26. z=zin.getNextEntry();
  27.  
  28.  
  29.  
  30. while(z!=null)
  31. {
  32. out=new FileOutputStream(z.getName());
  33. bout=new BufferedOutputStream(out);
  34. System.out.println("copmress "+z.getName()+" with size "+(zin.available()));
  35. while(true)
  36. {
  37. int b=zin.read();
  38. if(b==-1)
  39. break;
  40. bout.write(b);
  41. }
  42. bout.close();
  43. z=zin.getNextEntry();
  44. }
  45. zin.close();
  46. }
  47.  
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement