This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static String decompress(byte[] compressedData) throws IOException { | |
try (ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(compressedData); | |
GZIPInputStream gzipInputStream = new GZIPInputStream(byteArrayInputStream)) { | |
StringBuilder outStr = new StringBuilder(); | |
byte[] buffer = new byte[1024]; | |
int len; | |
while ((len = gzipInputStream.read(buffer)) != -1) { | |
outStr.append(new String(buffer, 0, len, "UTF-8")); | |
} |