当前位置: 首页>>代码示例>>C#>>正文


C# IEncoder.Encode方法代码示例

本文整理汇总了C#中IEncoder.Encode方法的典型用法代码示例。如果您正苦于以下问题:C# IEncoder.Encode方法的具体用法?C# IEncoder.Encode怎么用?C# IEncoder.Encode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IEncoder的用法示例。


在下文中一共展示了IEncoder.Encode方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: WriteAsset

        public virtual void WriteAsset(Bundle bundle, IEncoder encoder)
        {
            response.ContentType = bundle.ContentType;
            CacheLongTime(bundle.Hash.ToHexString(), bundle.BrowserTtl);

            using (var stream = bundle.Content)
            {
                stream.CopyTo(response.OutputStream);
            }

            encoder.Encode(response);
        }
开发者ID:justin-arvay,项目名称:WebAssetBundler,代码行数:12,代码来源:ResponseWriter.cs

示例2: Encode

 /// <summary>
 /// Encode this histogram into a <see cref="ByteBuffer"/>
 /// </summary>
 /// <param name="targetBuffer">The buffer to encode into</param>
 /// <param name="encoder">The encoder to use</param>
 /// <returns>The number of bytes written to the buffer</returns>
 public int Encode(ByteBuffer targetBuffer, IEncoder encoder)
 {
     var data = GetData();
     return encoder.Encode(data, targetBuffer);
 }
开发者ID:HdrHistogram,项目名称:HdrHistogram.NET,代码行数:11,代码来源:HistogramBase.cs

示例3: Write

        /// <summary>
        ///     Writes the header to the specified encoder.
        /// </summary>
        /// <param name="encoder">The encoder.</param>
        public void Write(IEncoder encoder)
        {
            if (encoder == null)
            {
                throw new ArgumentNullException("encoder");
            }

            encoder.EncodeFixed(Magic);
            encoder.EncodeMapChunk(this.metadata.Count);
            foreach (var pair in this.metadata)
            {
                encoder.Encode(pair.Key);
                encoder.Encode(pair.Value);
            }

            if (this.metadata.Count != 0)
            {
                encoder.EncodeMapChunk(0);
            }

            encoder.EncodeFixed(this.syncMarker);
        }
开发者ID:RossMerr,项目名称:azure-sdk-for-net,代码行数:26,代码来源:ObjectContainerHeader.cs

示例4: Serialize

 public string Serialize(License license, IEncoder encoder)
 {
     byte[] buffer;
     using (MemoryStream stream = new MemoryStream())
     {
         WriteLicenseToStream(license, stream);
         buffer = stream.ToArray();
     }
     return Base32Encoder.Encode(encoder.Encode(buffer));
 }
开发者ID:bormaxi,项目名称:VisualSVN_Crack,代码行数:10,代码来源:Licensing.cs

示例5: GetEncodedContents

        /// <summary>
        /// Get the contents, encoded for shipping via SMTP
        /// </summary>
        /// <param name="encoder">The encoder to encode the contents</param>
        /// <returns>returns the encoded string, ready for SMTP transfer</returns>
        internal virtual String GetEncodedContents(IEncoder encoder)
        {
            StringBuilder sb=new StringBuilder();
            System.Text.Encoding charset=null;
            if (_charset==null)
            {
                charset=System.Text.Encoding.UTF8;
            }
            else
            {
                charset=this._charset;
            }

            if (_contents!=null)
            {
                encoder.Encode(new StringReader(_contents), new StringWriter(sb), charset);
            }
            else if (_fileinfo!=null)
            {
                encoder.Encode(_fileinfo.OpenRead(), new StringWriter(sb), charset);
            }
            else if (_contentbytes!=null)
            {
                encoder.Encode(new BinaryReader(new MemoryStream(_contentbytes)), new StringWriter(sb));
            }
            String encodedcontents=sb.ToString();

            if (encodedcontents.Length!=0 && encodedcontents[encodedcontents.Length-1]!='\n')
            {
                return encodedcontents+SmtpProxy.ENDOFLINE+SmtpProxy.ENDOFLINE;
            }
            else
            {
                return encodedcontents+SmtpProxy.ENDOFLINE;
            }
        }
开发者ID:prasaathp,项目名称:Application,代码行数:41,代码来源:AbstractEmailAttachment.cs


注:本文中的IEncoder.Encode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。