public override void Write(byte[] buffer, int offset, int count) { deflater_.SetInput(buffer, offset, count); Deflate(); }
public byte[] Compress(byte[] bytData, params int[] ratio) { int compRatio = 9; try { if (ratio[0] > 0) { compRatio = ratio[0]; } } catch { throw; } try { var ms = new MemoryStream(); var defl = new Deflater(compRatio, false); Stream s = new DeflaterOutputStream(ms, defl); s.Write(bytData, 0, bytData.Length); s.Close(); byte[] compressedData = ms.ToArray(); return compressedData; } catch { throw; } }