Decompresses the given byte array

@param compressed byte array input
@return decompressed data in string format
@throws IOException
774462
public static String decompressStringNonBase64(byte[] compressed) throws IOException {
        ByteArrayInputStream is = new ByteArrayInputStream(compressed);
        try (InputStream gis = new GZIPInputStream(is)) {
            return new String(IOUtils.toByteArray(gis), StandardCharsets.UTF_8);
        }
    }
687772
private void writeCompressedText(File file, byte[] compressedContent) throws IOException
    {
        ByteArrayInputStream bais   = new ByteArrayInputStream(compressedContent);
        GZIPInputStream      gis    = new GZIPInputStream(bais);
        BufferedReader       input  = new BufferedReader(new InputStreamReader(gis));
        BufferedWriter       output = new BufferedWriter(new FileWriter(file));
        String               line;

        while ((line = input.readLine()) != null)
        {
            output.write(line);
            output.write('\n');
        }
        input.close();
        gis.close();
        bais.close();
        output.close();
    }
1294717
private static String decompress(String str) throws EncoderException {
    /* First base64 decode the string */
    byte[] bytes = Base64.decodeBase64(str);
    GZIPInputStream zi = null;
    try {
      zi = new GZIPInputStream(new ByteArrayInputStream(bytes));
      InputStreamReader reader = new InputStreamReader(zi);
      BufferedReader in = new BufferedReader(reader);
      StringBuilder sb = new StringBuilder();
      String read;
      while ((read = in.readLine()) != null) {
        sb.append(read + "\n");
      }

      String molfile = sb.toString();
      reader.close();
      in.close();
      zi.close();
      return molfile;

    } catch (IOException e) {
      throw new EncoderException("Molfile could not be decompressed. " + str);
    } finally {
      IOUtils.closeQuietly(zi);
    }

  }
691892
public RawResponse decompress(boolean decompress) {
        return new RawResponse(method, url, statusCode, statusLine, cookies, headers, body, charset, decompress);
    }
44923
public static byte[] decompress(byte[] data) throws Exception {
		ByteArrayInputStream bais = new ByteArrayInputStream(data);
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		decompress(bais, baos);
		data = baos.toByteArray();
		baos.flush();
		baos.close();
		bais.close();
		return data;
	}
89327
private byte[] toJSONStringCompressed() {
        String str = toJSONString();
        if (str == null || str.length() == 0) {
            return new byte[0] ;
        }
        byte[] outStr;
        try {
            outStr = compressJSONString(str);
        } catch (IOException e) {
            throw new RuntimeException("Failed to serialize Hashinator Configuration to Compressed JSON .", e);
        }
        return outStr;
    }
547055
public static void compressString(InputStream inputStream, OutputStream outputStream) throws IOException {
        try (ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream()) {
            fillExportStreamCompress(inputStream, byteArrayOutputStream);
            // to do -> make it in chunks
            String result = getStringFromEncode(byteArrayOutputStream.toByteArray());
            try (PrintWriter printWriter = new PrintWriter(outputStream)) {
                printWriter.write(result);
            }
        }
    }
389910
@Override
    synchronized public int encodeIntoCompressedByteBuffer(
            final ByteBuffer targetBuffer,
            final int compressionLevel) {
        int neededCapacity = getNeededByteBufferCapacity(countsArrayLength);
        if (intermediateUncompressedByteBuffer == null || intermediateUncompressedByteBuffer.capacity() < neededCapacity) {
            intermediateUncompressedByteBuffer = ByteBuffer.allocate(neededCapacity).order(BIG_ENDIAN);
        }
        intermediateUncompressedByteBuffer.clear();
        int initialTargetPosition = targetBuffer.position();

        final int uncompressedLength = encodeIntoByteBuffer(intermediateUncompressedByteBuffer);
        targetBuffer.putInt(getCompressedEncodingCookie());

        targetBuffer.putInt(0); // Placeholder for compressed contents length

        Deflater compressor = new Deflater(compressionLevel);
        compressor.setInput(intermediateUncompressedByteBuffer.array(), 0, uncompressedLength);
        compressor.finish();

        byte[] targetArray;

        if (targetBuffer.hasArray()) {
            targetArray = targetBuffer.array();
        } else {
            if (intermediateUncompressedByteArray == null ||
                intermediateUncompressedByteArray.length < targetBuffer.capacity()) {
                intermediateUncompressedByteArray = new byte[targetBuffer.capacity()];
            }
            targetArray = intermediateUncompressedByteArray;
        }

        int compressedTargetOffset = initialTargetPosition + 8;
        int compressedDataLength =
            compressor.deflate(
                targetArray,
                compressedTargetOffset,
                targetArray.length - compressedTargetOffset
            );
        compressor.end();

        if (!targetBuffer.hasArray()) {
            targetBuffer.put(targetArray, compressedTargetOffset, compressedDataLength);
        }

        targetBuffer.putInt(initialTargetPosition + 4, compressedDataLength); // Record the compressed length
        int bytesWritten = compressedDataLength + 8;
        targetBuffer.position(initialTargetPosition + bytesWritten);
        return bytesWritten;
    }
523436
public static byte[] decodeLZ(byte[] data, String dictionary) {
    try {
      Inflater decompresser = new Inflater();
      decompresser.setInput(data, 0, data.length);
      byte[] result = new byte[data.length * 32];
      int resultLength = 0;
      if (!dictionary.isEmpty()) {
        resultLength = decompresser.inflate(result);
        assert (0 == resultLength);
        if (decompresser.needsDictionary()) {
          byte[] bytes = dictionary.getBytes("UTF-8");
          decompresser.setDictionary(bytes);
        }
      }
      resultLength = decompresser.inflate(result);
      decompresser.end();
      return Arrays.copyOfRange(result, 0, resultLength);
    } catch (DataFormatException | UnsupportedEncodingException e) {
      throw new RuntimeException(e);
    }
  }
560574
public void setCompressedData(byte[] compressedData) {
		if (compressedData != null) {
			this.compressedData = Arrays.copyOf(compressedData, compressedData.length);
		}
	}
1343835
public static final byte[] compress(byte[] data, int level) throws IOException {
		final Deflater deflater = new Deflater(level, true);
		deflater.setInput(data);
		deflater.finish();
		final byte[] buffer = new byte[data.length + 128];
		final int length = deflater.deflate(buffer);
		final byte[] compressed = new byte[length];
		System.arraycopy(buffer, 0, compressed, 0, length);
		return compressed;
	}
343404
public List<WsByteBuffer> decompress(WsByteBuffer inputBuffer) throws DataFormatException {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.entry(tc, "decompress, input=" + inputBuffer);
        }
        List<WsByteBuffer> list = new LinkedList<WsByteBuffer>();
        int dataSize = inputBuffer.remaining();
        byte[] input = new byte[dataSize];
        inputBuffer.get(input, 0, dataSize);
        int inOffset = 0;

        //if the inflater is finished, then this is a repeat call
        //to decompress with the same handler and a reset is required
        if (this.inflater.finished())
            reset();

        if (!this.inflater.finished()) {
            this.inflater.setInput(input, inOffset, dataSize - inOffset);
        }
        long initialBytesRead = this.inflater.getBytesRead();
        int outOffset = 0;

        // keep decompressing until we've used up the entire input buffer or reached
        // the end of the compressed stream
        int len = -1;
        while (inOffset < input.length && !this.inflater.finished() && 0 != len) {
            try {
                len = this.inflater.inflate(this.buf, outOffset, this.buf.length - outOffset);
            } catch (DataFormatException dfe) {
                // no FFDC required, clean up any buffers we've allocated so far
                release(list);
                throw dfe;
            }
            long bytesRead = this.inflater.getBytesRead();
            inOffset += (bytesRead - initialBytesRead);
            initialBytesRead = bytesRead;
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "Decompressed amount=" + len + " inOffset=" + inOffset + " read=" + this.inflater.getBytesRead() + " written=" + this.inflater.getBytesWritten()
                             + " finished=" + this.inflater.finished());
            }
            outOffset += len;
            if (outOffset == this.buf.length) {
                WsByteBuffer buffer = HttpDispatcher.getBufferManager().allocate(this.buf.length);
                buffer.put(this.buf, 0, this.buf.length);
                buffer.flip();
                list.add(buffer);
                outOffset = 0;
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                    Tr.debug(tc, "Storing decompressed buffer; " + buffer);
                }
            }
        }
        // save off any extra output that is ready
        if (0 < outOffset) {
            WsByteBuffer buffer = HttpDispatcher.getBufferManager().allocate(outOffset);
            buffer.put(this.buf, 0, outOffset);
            buffer.flip();
            list.add(buffer);
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "Stored final decompressed buffer; " + buffer);
            }
        }
        if (inOffset < dataSize) {
            // did not use the entire buffer
            inputBuffer.position(inputBuffer.position() - (dataSize - inOffset));
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "input buffer has unused data; " + inputBuffer);
            }
        }
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.exit(tc, "decompress, output=" + list.size());
        }
        return list;
    }
1244365
public static byte[] rawCompress(Object data, int byteSize)
            throws IOException
    {
        byte[] buf = new byte[Snappy.maxCompressedLength(byteSize)];
        int compressedByteSize = impl.rawCompress(data, 0, byteSize, buf, 0);
        byte[] result = new byte[compressedByteSize];
        System.arraycopy(buf, 0, result, 0, compressedByteSize);
        return result;
    }
1126932
public HttpResponse decompress() throws IOException {
    String enc = header("Content-Encoding");
    return (enc != null && enc.contains("gzip")) ? unzip() : this;
  }
544212
public static String uncompress(String compressedValue) throws IOException {
        if (compressedValue == null)
            return null;

        ByteArrayInputStream in = new ByteArrayInputStream(compressedValue.getBytes("ISO-8859-1"));
        GZIPInputStream gzip = null;
        Reader reader = null;
        try {
            String value = "";
            gzip = new GZIPInputStream(in);
            reader = new InputStreamReader(gzip, "ISO-8859-1");
            int i;
            while ((i = reader.read()) != -1)
                value += (char) i;
            return value;
        }
        finally {
            if (gzip != null)
                gzip.close();
            if (reader != null)
                reader.close();
        }
    }
202542
public static byte[] encode(final byte[] data) throws IOException {
        ByteArrayOutputStream byteOut = new ByteArrayOutputStream();
        DeflaterOutputStream deflateOut = null;
        try {
            deflateOut = new DeflaterOutputStream(byteOut);
            deflateOut.write(data);
            deflateOut.close();
            byteOut.close();
            return byteOut.toByteArray();
        } finally {
            deflateOut.close();
            byteOut.close();
        }
    }
418165
public static String uncompressString(byte[] input, int offset, int length, String encoding)
            throws IOException,
            UnsupportedEncodingException
    {
        byte[] uncompressed = new byte[uncompressedLength(input, offset, length)];
        uncompress(input, offset, length, uncompressed, 0);
        return new String(uncompressed, encoding);
    }