/// <summary> /// Packs the byte array. /// </summary> public static byte[] Pack(byte[] bytes) { if (bytes == null || bytes.Length == 0 || !AllowPacking) { return(bytes); } return(AddZipSignature(StiGZipHelper.Pack(bytes))); }
/// <summary> /// Packs the stream. /// </summary> public static Stream Pack(Stream stream) { if (stream == null || stream.Length == 0 || !AllowPacking) { return(stream); } return(StiGZipHelper.Pack(stream)); }
/// <summary> /// Packs string and convert it to byte array. /// </summary> public static byte[] PackToBytes(string str) { if (string.IsNullOrEmpty(str)) { return(null); } var bytes = StiGZipHelper.ConvertStringToByteArray(str); if (bytes != null && bytes.Length != 0 && AllowPacking) { bytes = AddZipSignature(StiGZipHelper.Pack(bytes)); } return(bytes); }