コード例 #1
0
 public StreamFormatter(Stream stream, FormattingData formattingData, ManagedBufferPool <byte> pool, int bufferSize = 256)
 {
     _pool   = pool;
     _buffer = null;
     if (bufferSize > 0)
     {
         _buffer = _pool.RentBuffer(bufferSize);
     }
     _formattingData = formattingData;
     _stream         = stream;
 }
コード例 #2
0
 public BufferFormatter(int capacity, FormattingData formattingData, ManagedBufferPool <byte> pool = null)
 {
     _formattingData = formattingData;
     _count          = 0;
     _pool           = pool;
     if (_pool == null)
     {
         _pool = new ManagedBufferPool <byte>(capacity);
     }
     _buffer = _pool.RentBuffer(capacity);
 }
コード例 #3
0
 public ArraySegment <byte> GetFreeBuffer(int minBytes)
 {
     if (this._buffer == null)
     {
         this._buffer = pool.RentBuffer(minBytes);
     }
     else if (this._buffer.Length < minBytes)
     {
         pool.EnlargeBuffer(ref this._buffer, minBytes);
     }
     return(new ArraySegment <byte>(this._buffer));
 }
コード例 #4
0
 public MemoryWriter()
 {
     this._buffer = pool.RentBuffer(64);
 }
コード例 #5
0
 public StringFormatter(int capacity, ManagedBufferPool <byte> pool)
 {
     _pool   = pool;
     _buffer = _pool.RentBuffer(capacity * 2);
 }