Uncompressing a File in the GZIP Format

try { // Open the compressed file String inFilename = "infile.gzip"; GZIPInputStream in = new GZIPInputStream(new FileInputStream(inFilename)); // Open the output file String outFilename = "outfile"; OutputStream out = new FileOutputStream(outFilename); // Transfer bytes from the compressed file to the output file byte[] buf = new byte[1024]; int len; while ((len = in.read(buf)) > 0) { out.write(buf, 0, len); } // Close the file and stream in.close(); out.close(); } catch (IOException e) { }

Post a comment

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters shown in the image. Ignore spaces and be careful about upper and lower case.