/// <summary> /// GZip解压 /// </summary> /// <param name="s">待解压数据输入流</param> /// <param name="os">解压后的数据输出流</param> public static void GZipDecompress(Stream s, Stream os) { GZipInputStream gis = new GZipInputStream(s); Stdio.CopyStream(gis, os); os.Flush(); }
/// <summary> /// 数据解压 /// </summary> /// <param name="s">待解压数据输入流</param> /// <param name="os">解压后的数据输出流</param> /// <param name="inflater">解压器</param> public static void Decompress(Stream s, Stream os, Inflater inflater) { InflaterInputStream iis = new InflaterInputStream(s, inflater, 1024 * 4); Stdio.CopyStream(iis, os); os.Flush(); }
/// <summary> /// GZip压缩 /// </summary> /// <param name="s">待压缩数据输入流</param> /// <param name="os">压缩后的数据输出流</param> public static void GZipCompress(Stream s, Stream os) { GZipOutputStream gos = new GZipOutputStream(os, 1024 * 4); Stdio.CopyStream(s, gos); gos.Finish(); }
/// <summary> /// 数据压缩 /// </summary> /// <param name="s">待压缩数据输入流</param> /// <param name="os">压缩后的数据输出流</param> /// <param name="deflater">压缩器</param> public static void Compress(Stream s, Stream os, Deflater deflater) { DeflaterOutputStream dos = new DeflaterOutputStream(os, deflater, 1024 * 4); Stdio.CopyStream(s, dos); dos.Finish(); }