Package org.apache.mina.codec

Examples of org.apache.mina.codec.IoBuffer.position()


            IoBuffer buffer = IoBuffer.wrap(encoder.encode(value));

            for (int i = 0; i < buffer.remaining(); i++) {
                IoBuffer partialBuffer = buffer.slice();
                partialBuffer.limit(partialBuffer.position() + i);
                try {
                    assertNull(decoder.decode(partialBuffer));
                } catch (ProtocolDecoderException e) {
                    fail("Should not throw exception");
                }
View Full Code Here


            ByteBuffer buffer = encoder.encode(value);

            for (int i = 1; i < 5; i++) {
                int size = buffer.remaining() + i;
                IoBuffer extendedBuffer = IoBuffer.wrap(ByteBuffer.allocate(size));
                int start = extendedBuffer.position();
                extendedBuffer.put(buffer.slice());
                extendedBuffer.position(start);
                extendedBuffer.limit(start + size);

                try {
View Full Code Here

            for (int i = 1; i < 5; i++) {
                int size = buffer.remaining() + i;
                IoBuffer extendedBuffer = IoBuffer.wrap(ByteBuffer.allocate(size));
                int start = extendedBuffer.position();
                extendedBuffer.put(buffer.slice());
                extendedBuffer.position(start);
                extendedBuffer.limit(start + size);

                try {
                    decoder.decode(extendedBuffer);
                    assertEquals(i, extendedBuffer.remaining());
View Full Code Here

            nextBlockSize.setValue(sizeDecoder.decode(input));
        }

        if (nextBlockSize.isDefined() && (input.remaining() >= nextBlockSize.getValue())) {
            IoBuffer buffer = input.slice();
            buffer.limit(buffer.position() + nextBlockSize.getValue());

            output = payloadDecoder.decode(buffer);
            nextBlockSize.reset();
        }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.