Java Utililty Methods Ungzip

List of utility methods to do Ungzip

Description

The list of methods to do Ungzip are organized into topic(s).

Method

voiddecompressGZIP(String sourceFilename, String targetFilename)
decompress GZIP
copyStream(new GZIPInputStream(new FileInputStream(sourceFilename)), new FileOutputStream(targetFilename));
voiddecompressGzipFile(String gzipFile, String newFile)
decompress Gzip File
try {
    FileInputStream fis = new FileInputStream(gzipFile);
    GZIPInputStream gis = new GZIPInputStream(fis);
    FileOutputStream fos = new FileOutputStream(newFile);
    byte[] buffer = new byte[1024];
    int len;
    while ((len = gis.read(buffer)) != -1) {
        fos.write(buffer, 0, len);
...
StringdecompressGzipString(String gzipFile)
decompressGzipString -- Decompress a .gz file into a String.
try {
    FileInputStream fis = new FileInputStream(gzipFile);
    ByteArrayOutputStream bos;
    try (GZIPInputStream gis = new GZIPInputStream(fis)) {
        bos = new ByteArrayOutputStream();
        byte[] buffer = new byte[1024];
        int len;
        while ((len = gis.read(buffer)) != -1) {
...