List of utility methods to do Gunzip File
File | gunzip(File gzippedFile) Unzips a file. OutputStream out = null; GZIPInputStream gzipInputStream = null; File gunzippedFile = new File(System.getProperty("java.io.tmpdir") + File.separatorChar + gzippedFile.getName().replace(".gz", "")); try { InputStream in = new FileInputStream(gzippedFile); gzipInputStream = new GZIPInputStream(in); out = new FileOutputStream(gunzippedFile); ... |
void | gunzip(File gzippedFile, File destinationFile) Uncompress gzipped files int buffer = 2048; FileInputStream in = new FileInputStream(gzippedFile); GZIPInputStream zipin = new GZIPInputStream(in); byte[] data = new byte[buffer]; FileOutputStream out = new FileOutputStream(destinationFile); try { int length; while ((length = zipin.read(data, 0, buffer)) != -1) ... |
void | gUnzip(File srcFile, File destFile) GUnzips a source File to a destination File. FileOutputStream fos = null; GZIPInputStream zIn = null; InputStream fis = null; try { fos = new FileOutputStream(destFile); fis = new FileInputStream(srcFile); zIn = new GZIPInputStream(fis); copy(zIn, fos); ... |
void | gunzip(InputStream packedData, OutputStream unpackedData) gunzip copy(new GZIPInputStream(packedData), unpackedData);
|
String | gunzip(String compressedStr) gunzip if (compressedStr == null) { return null; ByteArrayOutputStream out = new ByteArrayOutputStream(); ByteArrayInputStream in = null; GZIPInputStream ginzip = null; byte[] compressed = null; String decompressed = null; ... |
void | gunzip(String inFile, String outFile) gunzip byte[] buffer = new byte[1024]; try { System.out.println("Gunzip..."); GZIPInputStream gzis = new GZIPInputStream(new FileInputStream(inFile)); FileOutputStream out = new FileOutputStream(outFile); int len; while ((len = gzis.read(buffer)) > 0) { out.write(buffer, 0, len); ... |
void | gunzipFile(File baseDir, File gzFile) gunzip File System.out.println("gunzip'ing File: " + gzFile.toString()); Process p = Runtime.getRuntime().exec(String.format("gunzip %s", gzFile.getAbsolutePath())); BufferedReader stdError = new BufferedReader(new InputStreamReader(p.getErrorStream())); System.out.println("Here is the standard error of the command (if any):\n"); String s; while ((s = stdError.readLine()) != null) { System.out.println(s); stdError.close(); |
int | gunzipFile(File file_input, File dir_output) Gunzip an input file. GZIPInputStream gzip_in_stream; try { FileInputStream in = new FileInputStream(file_input); BufferedInputStream source = new BufferedInputStream(in); gzip_in_stream = new GZIPInputStream(source); } catch (IOException e) { System.out.println("Error in gunzipFile(): " + e.toString()); return 0; ... |
void | gunzipFile(File inputGZippedFile, File outputFile) Gunzips one file from the inputGZippedFile and unzips to outputUnZippedFile java.util.zip.GZIPInputStream input = new java.util.zip.GZIPInputStream( new java.io.FileInputStream(inputGZippedFile)); java.io.FileOutputStream output = new java.io.FileOutputStream(outputFile); int buffersize = 100; byte[] buf = new byte[buffersize]; int read = input.read(buf, 0, buffersize); while (read != -1) { output.write(buf, 0, read); ... |
String | ungzip(byte[] bytes) ungzip InputStreamReader isr = new InputStreamReader(new GZIPInputStream(new ByteArrayInputStream(bytes)), StandardCharsets.UTF_8); StringWriter sw = new StringWriter(); char[] chars = new char[1024]; for (int len; (len = isr.read(chars)) > 0;) { sw.write(chars, 0, len); return sw.toString(); ... |