Utils class: compression string gzip

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.zip.GZIPInputStream;
import java.util.zip.GZIPOutputStream;

public class Compression {
    public static byte[] compress(String paramString) throws IOException {
        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(paramString.length());
        GZIPOutputStream gzipOutputStream = new GZIPOutputStream(byteArrayOutputStream);
        gzipOutputStream.write(paramString.getBytes());
        gzipOutputStream.close();
        byte[] bytes = byteArrayOutputStream.toByteArray();
        byteArrayOutputStream.close();
        return bytes;
    }

    public static String decompress(byte[] paramArrayOfByte) throws IOException {
        ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(paramArrayOfByte);
        GZIPInputStream gzipInputStream = new GZIPInputStream(byteArrayInputStream, 32);
        StringBuilder stringBuilder = new StringBuilder();
        byte[] bytes = new byte[32];
        for (; ; ) {
            int i = gzipInputStream.read(bytes);
            if (i == -1) {
                break;
            }
            stringBuilder.append(new String(bytes, 0, i));
        }
        gzipInputStream.close();
        byteArrayInputStream.close();
        return stringBuilder.toString();
    }
}