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; }
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); }
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)); }
public MemoryWriter() { this._buffer = pool.RentBuffer(64); }
public StringFormatter(int capacity, ManagedBufferPool <byte> pool) { _pool = pool; _buffer = _pool.RentBuffer(capacity * 2); }