Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p><a href="http://java.sun.com/j2se/1.4.2/docs/api/java/util/zip/package-summary.html" rel="nofollow noreferrer">http://java.sun.com/j2se/1.4.2/docs/api/java/util/zip/package-summary.html</a> <a href="http://www.roseindia.net/java/beginners/JavaUncompress.shtml" rel="nofollow noreferrer">http://www.roseindia.net/java/beginners/JavaUncompress.shtml</a></p> <pre><code>import java.util.zip; import java.io.OutputStream; import java.io.FileOutputStream; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; public class JavaUncompress{ public static void main(String args[]){ try{ //To Uncompress GZip File Contents we need to open the gzip file..... if(args.length&lt;=0){ System.out.println("Please enter the valid file name"); } else{ String inFilename = args[0]; System.out.println("Opening the gzip file.......................... : opened"); ZipInputStream zipInputStream = null; FileInputStream fileInputStream = null; zipInputStream = new ZipInputStream(new FileInputStream(inFilename)); System.out.println("Opening the output file............ : opened"); String outFilename = inFilename +".pdf"; OutputStream out = new FileOutputStream(outFilename); System.out.println("Transferring bytes from the compressed file to the output file........: Transfer successful"); byte[] buf = new byte[1024]; //size can be //changed according to programmer's need. int len; while ((len = zipInputStream.read(buf)) &gt; 0) { out.write(buf, 0, len); } System.out.println("The file and stream is ......closing.......... : closed"); zipInputStream.close(); out.close(); } } catch(IOException e){ System.out.println("Exception has been thrown" + e); } } } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload