private void decompress(byte[] data) { DataInputStream stream = new DataInputStream(data); if (_keys != null && _keys.Length != 0) { stream.decodeXTEA(_keys); } int compression = stream.readUnsignedByte(); _compression = (CompressionType)(compression > 2 ? 2 : compression); int compressedLength = stream.readInt(); if (compressedLength < 0 || compressedLength > 1000000) { throw new InvalidOperationException("INVALID ARCHIVE HEADER"); } int length; switch (_compression) { case CompressionType.RAW: _data = new byte[compressedLength]; checkRevision(stream, compressedLength); stream.Read(_data, 0, compressedLength); break; case CompressionType.BZIP: length = stream.readInt(); if (length <= 0) { _data = null; } else { _data = new byte[length]; checkRevision(stream, compressedLength); BZip2Decompressor.Decompress(_data, data); } break; default: // GZIP length = stream.readInt(); if (length <= 0 || length > 1000000000) { _data = null; } else { _data = new byte[length]; checkRevision(stream, compressedLength); GZipDecompressor.Decompress(_data, stream); } break; } }