Exemplo n.º 1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldProvideExpectedMetaData() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldProvideExpectedMetaData()
        {
            ChunkedInput <ByteBuf> replicatedContent = ChunkedReplicatedContent.Chunked(( sbyte )1, new ThreeChunks(this, -1, 8));

            UnpooledByteBufAllocator allocator = UnpooledByteBufAllocator.DEFAULT;

            ByteBuf byteBuf = replicatedContent.readChunk(allocator);

            // is not last
            assertFalse(byteBuf.readBoolean());
            // first chunk has content
            assertEquals(( sbyte )1, byteBuf.readByte());
            byteBuf.release();

            byteBuf = replicatedContent.readChunk(allocator);
            // is not last
            assertFalse(byteBuf.readBoolean());
            byteBuf.release();

            byteBuf = replicatedContent.readChunk(allocator);
            // is last
            assertTrue(byteBuf.readBoolean());
            byteBuf.release();

            assertNull(replicatedContent.readChunk(allocator));
        }
Exemplo n.º 2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private static void encode(io.netty.buffer.ByteBuf buffer, io.netty.handler.stream.ChunkedInput<io.netty.buffer.ByteBuf> marshal) throws Exception
        private static void Encode(ByteBuf buffer, ChunkedInput <ByteBuf> marshal)
        {
            while (!marshal.EndOfInput)
            {
                ByteBuf tmp = marshal.readChunk(UnpooledByteBufAllocator.DEFAULT);
                if (tmp != null)
                {
                    buffer.writeBytes(tmp);
                    tmp.release();
                }
            }
        }
Exemplo n.º 3
0
 internal MaxTotalSize(ChunkedInput <ByteBuf> chunkedInput) : this(chunkedInput, _defaultMaxSize)
 {
 }
Exemplo n.º 4
0
 internal MaxTotalSize(ChunkedInput <ByteBuf> chunkedInput, int maxSize)
 {
     requirePositive(maxSize);
     this._chunkedInput = chunkedInput;
     this._maxSize      = maxSize;
 }