Decompress the given array of bytes.

@return null if the bytes cannot be decompressed
336321
protected byte[] decompress(byte[] in) {
    switch (this.compressMode) {
      case GZIP:
        return gzipDecompress(in);
      case ZIP:
        return zipDecompress(in);
      default:
        return gzipDecompress(in);
    }
  }
1297690
public byte[] toByteArray() throws IOException {
        DerOutputStream out = new DerOutputStream();

        encode(out);
        data.reset();
        return out.toByteArray();
    }
133817
public static String decompressZlib(byte[] compressedData, long maxBytes) throws IOException {
        try (final ByteArrayInputStream dataStream = new ByteArrayInputStream(compressedData);
             final InflaterInputStream in = new InflaterInputStream(dataStream);
             final InputStream limited = ByteStreams.limit(in, maxBytes)) {
            return new String(ByteStreams.toByteArray(limited), StandardCharsets.UTF_8);
        }
    }
516252
static void lowLevelUncompressBytes(
      final byte[] byteArray,          // output
      final int numBytesToDecode,      // input (but refers to the output)
      final short[] decodingTable,     // input
      final int[] compressedWords,     // input
      final long numCompressedWords) { // input

    int byteIndex = 0;
    int nextWordIndex = 0;
    long bitBuf = 0;
    int bufBits = 0;

    assert (byteArray != null);
    assert (decodingTable != null);
    assert (compressedWords != null);

    for (byteIndex = 0; byteIndex < numBytesToDecode; byteIndex++) {
      //MAYBE_FILL_BITBUF(compressedWords,wordIndex,12); // ensure 12 bits in bit buffer
      if (bufBits < 12) { // Prepare for a 12-bit peek into the bitstream.
        bitBuf |= ((compressedWords[nextWordIndex++] & 0XFFFF_FFFFL) << bufBits);
        bufBits += 32;
      }

      // These 12 bits will include an entire Huffman codeword.
      final int peek12 = (int) (bitBuf & 0XFFFL);
      final int lookup = decodingTable[peek12] & 0XFFFF;
      final int codeWordLength = lookup >>> 8;
      final byte decodedByte = (byte) (lookup & 0XFF);
      byteArray[byteIndex] = decodedByte;
      bitBuf >>>= codeWordLength;
      bufBits -= codeWordLength;
    }

    // Buffer over-run should be impossible unless there is a bug.
    // However, we might as well check here.
    assert (nextWordIndex <= numCompressedWords);
  }
247522
protected void decompressData(HashMap m) {

        for (Object key : m.keySet()) {
            if (m.get(key) instanceof ArrayList) {
                // iterate sub array nodes
                decompressData((ArrayList) m.get(key));
            } else if (m.get(key) instanceof HashMap) {
                // iterate sub data nodes
                decompressData((HashMap) m.get(key));
            } else {
                // ignore other type nodes
            }
        }

    }
6165
public function toByte()
    {

        $size = $this->size();

        if($size == 0) {
            return array();
        }

        $data = array_fill(0, (int)(($size + 7) / 8), 0);
        $bytes = (int)($size / 8);

        $p = 0;

        for($i=0; $i<$bytes; $i++) {
            $v = 0;
            for($j=0; $j<8; $j++) {
                $v = $v << 1;
                $v |= $this->data[$p];
                $p++;
            }
            $data[$i] = $v;
        }

        if($size & 7) {
            $v = 0;
            for($j=0; $j<($size & 7); $j++) {
                $v = $v << 1;
                $v |= $this->data[$p];
                $p++;
            }
            $data[$bytes] = $v;
        }

        return $data;
    }
363716
public static final Bytes of(byte[] array) {
    Objects.requireNonNull(array);
    if (array.length == 0) {
      return EMPTY;
    }
    byte[] copy = new byte[array.length];
    System.arraycopy(array, 0, copy, 0, array.length);
    return new Bytes(copy);
  }
228106
public static String decompress(final byte[] strBytes) {

        if (strBytes[0] == UNCOMPRESSED_FLAG) {
            return new String(strBytes, 1, strBytes.length, Charsets.UTF_8);
        }

        final StringBuilder out = new StringBuilder();

        for (int i = 0; i < strBytes.length; i++) {
            final char b = (char) (0xFF & strBytes[i]);
            if (b == 254) {
                out.append((char) strBytes[++i]);
            } else if (b == 255) {
                final int length = 0xFF & strBytes[++i];
                for (int j = 1; j <= length; j++) {
                    out.append((char) strBytes[i + j]);
                }
                i += length;
            } else {
                final int loc = 0xFF & b;
                out.append(REVERSE_CODEBOOK[loc]);
            }
        }
        return out.toString();
    }
877413
@Override
    public INDArray get(T key) {
        try {
            if (emulateIsAbsent)
                lock.readLock().lock();

            if (containsKey(key)) {
                INDArray result = compressedEntries.get(key);

                // TODO: we don't save decompressed entries here, but something like LRU might be good idea
                return compressor.decompress(result);
            } else {
                return null;
            }
        } finally {
            if (emulateIsAbsent)
                lock.readLock().unlock();
        }
    }
1346238
@Deprecated
    public static byte[] encodeToBytes(byte[] bytes)
    {
        try {
            char[] chars = Base64.encode(bytes);
            String string = new String(chars);
            return string.getBytes(DEFAULT_ENCODING);
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
            return null;
        }
    }
567854
public static byte[] decode(final byte[] compressed) throws IOException {
        ByteArrayInputStream byteIn = new ByteArrayInputStream(compressed);
        ByteArrayOutputStream byteOut = new ByteArrayOutputStream();
        InflaterInputStream inflaterIn = null;
        try {
            inflaterIn = new InflaterInputStream(byteIn);
            int read;
            byte[] buffer = new byte[BUFFER_SIZE];
            do {
                read = inflaterIn.read(buffer);
                if (read > 0) {
                    byteOut.write(buffer, 0, read);
                }
            } while (read >= 0);
            return byteOut.toByteArray();
        } finally {
            inflaterIn.close();
            byteOut.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);
    }

  }
945984
public static function fromBytes(array $bytes)
    {
        $result = null;
        if (count($bytes) === 16) {
            $address = '';
            for ($i = 0; $i < 16; ++$i) {
                if ($i !== 0 && $i % 2 === 0) {
                    $address .= ':';
                }
                $byte = $bytes[$i];
                if (is_int($byte) && $byte >= 0 && $byte <= 255) {
                    $address .= sprintf('%02x', $byte);
                } else {
                    $address = null;
                    break;
                }
            }
            if ($address !== null) {
                $result = new static($address);
            }
        }

        return $result;
    }
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);
        }
    }
526144
function decompress (bitmap) {
	var fName = null;
	switch (bitmap.bitsPerPixel.value) {
	case 15:
		fName = 'bitmap_decompress_15';
		break;
	case 16:
		fName = 'bitmap_decompress_16';
		break;
	case 24:
		fName = 'bitmap_decompress_24';
		break;
	case 32:
		fName = 'bitmap_decompress_32';
		break;
	default:
		throw 'invalid bitmap data format';
	}
	
	var input = new Uint8Array(bitmap.bitmapDataStream.value);
	var inputPtr = rle._malloc(input.length);
	var inputHeap = new Uint8Array(rle.HEAPU8.buffer, inputPtr, input.length);
	inputHeap.set(input);
	
	var ouputSize = bitmap.width.value * bitmap.height.value * 4;
	var outputPtr = rle._malloc(ouputSize);

	var outputHeap = new Uint8Array(rle.HEAPU8.buffer, outputPtr, ouputSize);

	var res = rle.ccall(fName,
		'number',
		['number', 'number', 'number', 'number', 'number', 'number', 'number', 'number'],
		[outputHeap.byteOffset, bitmap.width.value, bitmap.height.value, bitmap.width.value, bitmap.height.value, inputHeap.byteOffset, input.length]
	);
	
	var output = new Uint8ClampedArray(outputHeap.buffer, outputHeap.byteOffset, ouputSize);
	
	rle._free(inputPtr);
	rle._free(outputPtr);
	
	return output;
}
1307984
protected byte[] compress(final byte[] in) {
        if (in == null) {
            throw new NullPointerException("Can't compress null");
        }

        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        GZIPOutputStream gz = null;

        try {
            gz = new GZIPOutputStream(bos);
            gz.write(in);
        } catch (IOException e) {
            throw new RuntimeException("IO exception compressing data", e);
        } finally {
            close(gz);
            close(bos);
        }

        return bos.toByteArray();
    }
510009
private byte[] unGZip(byte[] bytes) {
        if(bytes == null || bytes.length == 0) {
            return bytes;
        }

        GZIPInputStream gzis = null;
        ByteArrayOutputStream baos = null;

        try {
            gzis = new GZIPInputStream(new ByteArrayInputStream(bytes));
            baos = new ByteArrayOutputStream();

            int len;
            byte[] buffer = new byte[1024];

            while ((len = gzis.read(buffer)) > 0) {
                baos.write(buffer, 0, len);
            }

            return baos.toByteArray();
        } catch(IOException e) {
            // unable to work up
            // send back null
        } finally {
            if(gzis != null) {
                try {
                    gzis.close();
                } catch(IOException e) {
                    // eat up
                }
            }

            if(baos != null) {
                try {
                    baos.close();
                } catch (IOException e) {
                    // eat up
                }
            }
        }

        return null;
    }