Ejemplo n.º 1
0
        /// <summary>
        /// Write out the contents of data into the output stream
        /// </summary>
        /// <param name="os"></param>
        /// <param name="data"></param>
        /// <returns></returns>
        private NativePooledByteBuffer DoWrite(NativePooledByteBufferOutputStream os, byte[] data)
        {
            for (int i = 0; i < data.Length; i++)
            {
                os.Write(data, i, 1);
            }

            return((NativePooledByteBuffer)os.ToByteBuffer());
        }
Ejemplo n.º 2
0
        public void TestToByteBufException()
        {
            NativePooledByteBufferOutputStream os1 = new NativePooledByteBufferOutputStream(_pool);

            os1.Dispose();

            try
            {
                os1.ToByteBuffer();
                Assert.Fail();
            }
            catch (InvalidStreamException)
            {
                // This is expected
            }
        }