25 using Lucene.Net.Support;
49 public static byte[] Compress(byte[] value_Renamed,
int offset,
int length,
int compressionLevel)
55 System.IO.MemoryStream bos =
new System.IO.MemoryStream(length);
61 compressor.
SetLevel(compressionLevel);
62 compressor.
SetInput(value_Renamed, offset, length);
66 byte[] buf =
new byte[1024];
69 int count = compressor.
Deflate(buf);
70 bos.Write(buf, 0, count);
81 public static byte[] Compress(byte[] value_Renamed,
int offset,
int length)
87 public static byte[] Compress(byte[] value_Renamed)
93 public static byte[] CompressString(System.String value_Renamed)
102 public static byte[] CompressString(System.String value_Renamed,
int compressionLevel)
105 UnicodeUtil.UTF16toUTF8(value_Renamed, 0, value_Renamed.Length, result);
106 return Compress(result.result, 0, result.length, compressionLevel);
112 public static byte[] Decompress(byte[] value_Renamed)
115 System.IO.MemoryStream bos =
new System.IO.MemoryStream(value_Renamed.Length);
121 decompressor.
SetInput(value_Renamed);
124 byte[] buf =
new byte[1024];
127 int count = decompressor.
Inflate(buf);
128 bos.Write(buf, 0, count);
135 return bos.ToArray();
141 public static System.String DecompressString(byte[] value_Renamed)
144 byte[] bytes = Decompress(value_Renamed);
145 UnicodeUtil.UTF8toUTF16(bytes, 0, bytes.Length, result);
146 return new System.String(result.result, 0, result.length);