/// <summary> /// Initializes a new instance of the <see cref="HttpMessageEncoder"/> class. /// </summary> public HttpEncoder(BufferManager bufferManager) { _bufferManager = bufferManager; _headerStream = new MemoryStream(_buffer); _headerStream.SetLength(0); _writer = new StreamWriter(_headerStream); }
public SocketChannel(BufferManager bufferManager) { if (bufferManager == null) throw new ArgumentNullException("bufferManager"); _readBuffer = bufferManager.Pop(); _readArgs.SetBuffer(_readBuffer.Buffer, _readBuffer.Offset, _readBuffer.Capacity); _readArgs.Completed += OnReadCompleted; _writeArgs.SendPacketsFlags = TransmitFileOptions.WriteBehind; _writeArgs.Completed += OnWriteCompleted; }
public BufferSlice(BufferManager bufferManager, byte[] buffer, int offset, int count) { _bufferManager = bufferManager; if (offset + count > buffer.Length) throw new ArgumentOutOfRangeException("buffer", offset + count, "Offset+Count is larger than the buffer size. Buffer size: " + buffer.Length); if (offset < 0) throw new ArgumentOutOfRangeException("offset", offset, "Must be 0 or larger"); if (count < 1) throw new ArgumentOutOfRangeException("count", count, "At least 1 byte must be allocated for this slize."); Buffer = buffer; Offset = offset; Count2 = count; Capacity = count; }
public HttpListener(int bufferCount) { _mgr = new BufferManager(bufferCount, 65535); }