Decompress a complete Brotli-compressed string.

    :param data: A bytestring containing Brotli-compressed data.
320516
def decompress(data):
    
    d = Decompressor()
    data = d.decompress(data)
    d.finish()
    return data
178105
def decompressBuffer(buffer):
    ""
    zbuf = cStringIO.StringIO(buffer)
    zfile = gzip.GzipFile(fileobj=zbuf)
    deflated = zfile.read()
    zfile.close()
    return deflated
673821
def compress(info):
    
    if PY3:
        file_obj = BytesIO()
    else:
        file_obj = StringIO()

    with zipfile.ZipFile(
            file_obj,
            mode='w',
            compression=zipfile.ZIP_DEFLATED) as zipper:
        for name, data in info.items():
            if hasattr(data, 'read'):
                # if we were passed a file object, read it
                data = data.read()
            zipper.writestr(name, data)
    file_obj.seek(0)
    compressed = file_obj.read()
    return compressed
28805
def data_to_bytes(self, data_element, encoding=None):
        
        if encoding is None:
            encoding = self.encoding
        text = self.data_to_string(data_element)
        return bytes_(text, encoding=encoding)
709449
public static String decodeLZToString(byte[] data, String dictionary) {
    try {
      return new String(decodeLZ(data), "UTF-8");
    } catch (UnsupportedEncodingException e) {
      throw new RuntimeException(e);
    }
  }
915499
def load(string)
      marshal, compress, value = decompose(string)

      marshal.load(inflate(value, compress))
    rescue TypeError, NoMethodError
      string
    end
783173
public static byte[] encodeSourceData(DbFileSources.Data data) {
    ByteArrayOutputStream byteOutput = new ByteArrayOutputStream();
    LZ4BlockOutputStream compressedOutput = new LZ4BlockOutputStream(byteOutput);
    try {
      data.writeTo(compressedOutput);
      compressedOutput.close();
      return byteOutput.toByteArray();
    } catch (IOException e) {
      throw new IllegalStateException("Fail to serialize and compress source data", e);
    } finally {
      IOUtils.closeQuietly(compressedOutput);
    }
  }
640465
def encode(data):
    
    res = ""
    for i in range(0,len(data), 3):
        if (i+2==len(data)):
            res += _encode3bytes(ord(data[i]), ord(data[i+1]), 0)
        elif (i+1==len(data)):
            res += _encode3bytes(ord(data[i]), 0, 0)
        else:
            res += _encode3bytes(ord(data[i]), ord(data[i+1]), ord(data[i+2]))
    return res
205709
def compress(data):
    

    if isinstance(data, bytes):
        source = data
    elif isinstance(data, str):
        source = bytes(data, encoding='utf-8')
    else:
        raise RuntimeError("Compression is only supported for strings and bytes")

    return base64.b64encode(gzip.compress(source))
442920
def to_str(data):
    
    if isinstance(data, bytes):
        return codecs.decode(data, aws_encryption_sdk.internal.defaults.ENCODING)
    return data
178038
def decode(data):
    
    data = ensure_bytes(data, 'utf8')
    codec = get_codec(data)
    return codec.converter.decode(data[CODE_LENGTH:])
58280
def decode_data(self, data):
        
        assert self.get_empty() is False
        assert self._data_encoded is True
        if self._block_allowed:
            data = self._decode_transfer_block_data(data)
        else:
            data = self._decode_transfer_data(data)
        return data
989903
def bytes2zip(bytes):
    
    if hasattr(bytes, "read"):
        buff = TemporaryFile()
        archive = gzip.GzipFile(fileobj=buff, mode='w')
        for b in bytes:
            archive.write(b)
        archive.close()
        buff.seek(0)
        from pyLibrary.env.big_data import FileString, safe_size
        return FileString(buff)

    buff = BytesIO()
    archive = gzip.GzipFile(fileobj=buff, mode='w')
    archive.write(bytes)
    archive.close()
    return buff.getvalue()
161625
def zlib_decompress_to_string(blob):
    
    if PY3K:
        if isinstance(blob, bytes):
            decompressed = zlib.decompress(blob)
        else:
            decompressed = zlib.decompress(bytes(blob, 'utf-8'))
        return decompressed.decode('utf-8')
    return zlib.decompress(blob)
444114
public static byte[] hexStringToBytes(String data) {
        if (data == null)
            return EMPTY_BYTE_ARRAY;
        if (data.startsWith("0x"))
            data = data.substring(2);
        return Hex.decode(data);
    }
816228
def compress(data, compresslevel=9):
    
    buf = io.BytesIO()
    with GzipFile(fileobj=buf, mode='wb', compresslevel=compresslevel) as f:
        f.write(data)
    return buf.getvalue()
475965
private static String compress(String str) throws EncoderException {
	ByteArrayOutputStream rstBao = null;
	GZIPOutputStream zos = null;
    try {
    	rstBao = new ByteArrayOutputStream();
    	zos = new GZIPOutputStream(rstBao);
    	zos.write(str.getBytes());
    	IOUtils.closeQuietly(zos);
	    
    	byte[] bytes = rstBao.toByteArray();
    	return Base64.encodeBase64String(bytes);
    } catch(Exception e){
    	throw new EncoderException("Molfile could not be compressed. " + str);
   } finally{
	   IOUtils.closeQuietly(zos);
   }
	  
  }