Пример #1
0
        /// <summary>
        /// compresses bytess into string via the extended binary compression plugin
        /// </summary>
        /// <param name="compression">binary compression plugin</param>
        /// <param name="bytes">bytes to decode</param>
        /// <param name="encoding">string encoding type</param>
        /// <returns>string</returns>
        public static string DecompressString(this IBinaryCompression compression, byte[] bytes, Encoding encoding)
        {
            var decorator = new BinaryToString(compression, encoding);

            return(decorator.Decompress(bytes));
        }
Пример #2
0
 /// <summary>
 /// compresses bytess into string via the extended binary compression plugin
 /// </summary>
 /// <param name="compression">binary compression plugin</param>
 /// <param name="bytes">bytes to decode</param>
 /// <returns>string</returns>
 public static string DecompressString(this IBinaryCompression compression, byte[] bytes)
 {
     return(DecompressString(compression, bytes, Encoding.UTF8));
 }
Пример #3
0
 /// <summary>
 /// compresses a string into binary via the extended binary compression plugin
 /// </summary>
 /// <param name="compression">binary compression plugin</param>
 /// <param name="s">string to encode</param>
 /// <returns>binary</returns>
 public static byte[] CompressString(this IBinaryCompression compression, string s)
 {
     return(CompressString(compression, s, Encoding.UTF8));
 }
Пример #4
0
        /// <summary>
        /// compresses a string into binary via the extended binary compression plugin
        /// </summary>
        /// <param name="compression">binary compression plugin</param>
        /// <param name="s">string to encode</param>
        /// <param name="encoding">string encoding type</param>
        /// <returns>binary</returns>
        public static byte[] CompressString(this IBinaryCompression compression, string s, Encoding encoding)
        {
            var decorator = new BinaryToString(compression, encoding);

            return(decorator.Compress(s));
        }
Пример #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="BinaryToString"/> class.
 /// </summary>
 /// <param name="binary">binary compression plugin</param>
 /// <param name="encoding">text conding</param>
 public BinaryToString(IBinaryCompression binary, Encoding encoding)
 {
     this.binary   = binary;
     this.encoding = encoding;
 }