/// <summary> /// Instantiates the <see cref="NativePooledByteBufferFactory"/>. /// </summary> public NativePooledByteBufferFactory( NativeMemoryChunkPool pool, PooledByteStreams pooledByteStreams) { _pool = pool; _pooledByteStreams = pooledByteStreams; }
/// <summary> /// Construct a new instance of this output stream with this /// initial capacity. /// It is not an error to have this initial capacity be inaccurate. /// If the actual contents end up being larger than the /// initialCapacity, then we will reallocate memory if needed. /// If the actual contents are smaller, then we'll end up wasting /// some memory. /// </summary> /// <param name="pool">The pool to use.</param> /// <param name="initialCapacity"> /// Initial capacity to allocate for this stream. /// </param> public NativePooledByteBufferOutputStream( NativeMemoryChunkPool pool, int initialCapacity) { Preconditions.CheckArgument(initialCapacity > 0); _pool = Preconditions.CheckNotNull(pool); _count = 0; _bufRef = CloseableReference <NativeMemoryChunk> .of(_pool.Get(initialCapacity), _pool); }
/// <summary> /// Construct a new instance of this outputstream. /// </summary> /// <param name="pool">The pool to use.</param> public NativePooledByteBufferOutputStream(NativeMemoryChunkPool pool) : this(pool, pool.GetMinBufferSize()) { }