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


C# Text.Encoder类代码示例

本文整理汇总了C#中System.Text.Encoder的典型用法代码示例。如果您正苦于以下问题:C# Encoder类的具体用法?C# Encoder怎么用?C# Encoder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Encoder类属于System.Text命名空间,在下文中一共展示了Encoder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetRealObject

		public object GetRealObject (StreamingContext context)
		{
			if (this.realObject == null)
				this.realObject = this.encoding.GetEncoder ();

			return this.realObject;
		}
开发者ID:KonajuGames,项目名称:SharpLang,代码行数:7,代码来源:SurrogateEncoder.cs

示例2: EndianWriter

 // Protected default constructor that sets the output stream
 // to a null stream (a bit bucket).
 protected EndianWriter()
 {
     OutStream = Stream.Null;
     buffer = new byte[16];
     Encoding = new UTF8Encoding(false, true);
     encoder = Encoding.GetEncoder();
 }
开发者ID:vbfox,项目名称:U2FExperiments,代码行数:9,代码来源:EndianWriter.cs

示例3: XmlEncodedRawTextWriter

 public XmlEncodedRawTextWriter(Stream stream, XmlWriterSettings settings) : this(settings)
 {
     this.stream = stream;
     this.encoding = settings.Encoding;
     this.bufChars = new char[0x1820];
     this.bufBytes = new byte[this.bufChars.Length];
     this.bufBytesUsed = 0;
     this.trackTextContent = true;
     this.inTextContent = false;
     this.lastMarkPos = 0;
     this.textContentMarks = new int[0x40];
     this.textContentMarks[0] = 1;
     this.charEntityFallback = new CharEntityEncoderFallback();
     this.encoding = (Encoding) settings.Encoding.Clone();
     this.encoding.EncoderFallback = this.charEntityFallback;
     this.encoder = this.encoding.GetEncoder();
     if (!stream.CanSeek || (stream.Position == 0L))
     {
         byte[] preamble = this.encoding.GetPreamble();
         if (preamble.Length != 0)
         {
             this.stream.Write(preamble, 0, preamble.Length);
         }
     }
     if (settings.AutoXmlDeclaration)
     {
         this.WriteXmlDeclaration(this.standalone);
         this.autoXmlDeclaration = true;
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:30,代码来源:XmlEncodedRawTextWriter.cs

示例4: BinaryWriter

 // Protected default constructor that sets the output stream
 // to a null stream (a bit bucket).
 protected BinaryWriter()
 {
     OutStream = Stream.Null;
     _buffer = new byte[16];
     _encoding = new UTF8Encoding(false, true);
     _encoder = _encoding.GetEncoder();
 }
开发者ID:Numpsy,项目名称:mono,代码行数:9,代码来源:binarywriter.cs

示例5: MemoryPoolTextWriter

 public MemoryPoolTextWriter(IMemoryPool memory)
 {
     _memory = memory;
     _textArray = _memory.AllocChar(_textLength);
     _dataArray = _memory.Empty;
     _encoder = Encoding.UTF8.GetEncoder();
 }
开发者ID:fakedob,项目名称:KestrelHttpServer,代码行数:7,代码来源:MemoryPoolTextWriter.cs

示例6: ByteBuffer

 /// <summary>
 /// 构造函数
 /// </summary>
 public ByteBuffer()
 {
     this.BaseStream = new MemoryStream();
     this._buffer = new byte[0x10];
     this._encoding = Encoding.Default;//(false, true);
     this._encoder = this._encoding.GetEncoder();
 }
开发者ID:MACDfree,项目名称:nuniversalchardet,代码行数:10,代码来源:ByteBuffer.cs

示例7: StaticUtils

        static StaticUtils()
        {
            asciiDecoder = Encoding.ASCII.GetDecoder();

            utf8Encoder = Encoding.UTF8.GetEncoder();
            utf8Decoder = Encoding.UTF8.GetDecoder();
        }
开发者ID:SayHalou,项目名称:ospy,代码行数:7,代码来源:Util.cs

示例8: HttpResponseStreamWriter

        public HttpResponseStreamWriter(Stream stream, Encoding encoding, int bufferSize)
        {
            if (stream == null)
            {
                throw new ArgumentNullException(nameof(stream));
            }

            if (!stream.CanWrite)
            {
                throw new ArgumentException(Resources.HttpResponseStreamWriter_StreamNotWritable, nameof(stream));
            }

            if (encoding == null)
            {
                throw new ArgumentNullException(nameof(encoding));
            }

            _stream = stream;
            Encoding = encoding;
            _charBufferSize = bufferSize;

            if (bufferSize < MinBufferSize)
            {
                bufferSize = MinBufferSize;
            }

            _encoder = encoding.GetEncoder();
            _byteBuffer = new byte[encoding.GetMaxByteCount(bufferSize)];
            _charBuffer = new char[bufferSize];
        }
开发者ID:phinq19,项目名称:git_example,代码行数:30,代码来源:HttpResponseStreamWriter.cs

示例9: BinaryWriter

 // Protected default constructor that sets the output stream
 // to a null stream (a bit bucket).
 protected BinaryWriter()
 {
     OutStream = Stream.Null;
     _buffer = new byte[16];
     _encoding = EncodingCache.UTF8NoBOM;
     _encoder = _encoding.GetEncoder();
 }
开发者ID:kouvel,项目名称:coreclr,代码行数:9,代码来源:BinaryWriter.cs

示例10: MemoryPoolTextWriter

 public MemoryPoolTextWriter(IMemoryPool memory)
     : base(CultureInfo.InvariantCulture)
 {
     _memory = memory;
     _textArray = _memory.AllocChar(_textLength);
     _dataArray = MemoryPool.EmptyArray;
     _encoder = Encoding.UTF8.GetEncoder();
 }
开发者ID:Choulla-Naresh8264,项目名称:SignalR,代码行数:8,代码来源:MemoryPoolTextWriter.cs

示例11: Hash

 public static int Hash(string data, Encoder enc)
 {
     var arr = data.ToCharArray();
     int count = enc.GetByteCount(arr, 0, arr.Length, false);
     var bytes = new byte[count];
     enc.GetBytes(arr, 0, arr.Length, bytes, 0, false);
     return Hash(bytes);
 }
开发者ID:r-bel,项目名称:glorg2,代码行数:8,代码来源:CyclicRedundancy.cs

示例12: BinaryWriter

 protected BinaryWriter()
 {
     this._tmpOneCharBuffer = new char[1];
     this.OutStream = Stream.Null;
     this._buffer = new byte[0x10];
     this._encoding = new UTF8Encoding(false, true);
     this._encoder = this._encoding.GetEncoder();
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:8,代码来源:BinaryWriter.cs

示例13: TextReaderStream

 public TextReaderStream(TextReader textReader, Encoding encoding, int bufferSize = 4096)
 {
     _textReader = textReader;
     _encoding = encoding;
     _maxByteCountPerChar = _encoding.GetMaxByteCount(1);
     _encoder = encoding.GetEncoder();
     if (bufferSize <= 0) throw new ArgumentOutOfRangeException("bufferSize", "zero or negative");
     _charBuffer = new char[bufferSize];
 }
开发者ID:dmit25,项目名称:ntextcat,代码行数:9,代码来源:TextReaderStream.cs

示例14: HttpResponseStreamWriter

 public HttpResponseStreamWriter(Stream stream, Encoding encoding, int bufferSize)
 {
     _stream = stream;
     Encoding = encoding;
     _encoder = encoding.GetEncoder();
     _charBufferSize = bufferSize;
     _charBuffer = new ArraySegment<char>(new char[bufferSize]);
     _byteBuffer = new ArraySegment<byte>(new byte[encoding.GetMaxByteCount(bufferSize)]);
 }
开发者ID:benaadams,项目名称:mvc-sandbox,代码行数:9,代码来源:HttpResponseStreamWriter.cs

示例15: LineWriter

		public LineWriter(Stream stream, int bufferSize) {
			if (bufferSize < 1024)
				bufferSize = 1024;

			this.stream = stream;
			writeBuffer = new byte[bufferSize];
			writeBufferOffset = 0;
			encoder = Encoding.UTF8.GetEncoder();
		}
开发者ID:dbremner,项目名称:szotar,代码行数:9,代码来源:LineWriter.cs


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