Package org.apache.mina.common

Examples of org.apache.mina.common.ByteBuffer.limit()


            if (body.getSize() != 0)
            {
                if (body.getSize() != 0)
                {
                    ByteBuffer slice = body.getData().slice();
                    for (int j = 0; j < slice.limit(); j++)
                    {
                        msgContent.add(slice.get());
                    }
                }
            }
View Full Code Here


                handler );
       
        for( int i = 0; i < 10; i ++ )
        {
            ByteBuffer buf = ByteBuffer.allocate( 16 );
            buf.limit( 16 );
            fillWriteBuffer( buf, i );
            buf.flip();

            Object marker;
            if( ( i & 1 ) == 0 )
View Full Code Here

        Assert.assertEquals( 160, readBuf.position() );
        readBuf.flip();
       
        ByteBuffer expectedBuf = ByteBuffer.allocate( 160 );
        for( int i = 0; i < 10; i ++ ) {
            expectedBuf.limit( ( i + 1 ) * 16 );
            fillWriteBuffer( expectedBuf, i );
        }
        expectedBuf.position( 0 );
        assertEquals(expectedBuf, readBuf);
    }
View Full Code Here

        readBuf.clear();
        WriteFuture writeFuture = null;
        for( int i = 0; i < COUNT; i ++ )
        {
            ByteBuffer buf = ByteBuffer.allocate( DATA_SIZE );
            buf.limit( DATA_SIZE );
            fillWriteBuffer( buf, i );
            buf.flip();
           
            writeFuture = session.write( buf );
           
View Full Code Here

        readBuf.flip();
        SessionLog.info( session, "readBuf: " + readBuf );
        Assert.assertEquals( DATA_SIZE * COUNT, readBuf.remaining() );
        ByteBuffer expectedBuf = ByteBuffer.allocate( DATA_SIZE * COUNT );
        for( int i = 0; i < COUNT; i ++ ) {
            expectedBuf.limit( ( i + 1 ) * DATA_SIZE );
            fillWriteBuffer( expectedBuf, i );
        }
        expectedBuf.position( 0 );
       
        assertEquals(expectedBuf, readBuf);
View Full Code Here

                in.position(pos);

                if (ctx.getOverflowPosition() == 0) {
                    ByteBuffer buf = ctx.getBuffer();
                    buf.flip();
                    buf.limit(buf.limit() - matchCount);
                    try {
                        out.write(buf.getString(ctx.getDecoder()));
                    } finally {
                        buf.clear();
                    }
View Full Code Here

                in.position(pos);

                if (ctx.getOverflowPosition() == 0) {
                    ByteBuffer buf = ctx.getBuffer();
                    buf.flip();
                    buf.limit(buf.limit() - matchCount);
                    try {
                        out.write(buf.getString(ctx.getDecoder()));
                    } finally {
                        buf.clear();
                    }
View Full Code Here

                    in.position(pos);

                    if (ctx.getOverflowPosition() == 0) {
                        ByteBuffer buf = ctx.getBuffer();
                        buf.flip();
                        buf.limit(buf.limit() - matchCount);
                        try {
                            out.write(buf.getString(ctx.getDecoder()));
                        } finally {
                            buf.clear();
                        }
View Full Code Here

                    in.position(pos);

                    if (ctx.getOverflowPosition() == 0) {
                        ByteBuffer buf = ctx.getBuffer();
                        buf.flip();
                        buf.limit(buf.limit() - matchCount);
                        try {
                            out.write(buf.getString(ctx.getDecoder()));
                        } finally {
                            buf.clear();
                        }
View Full Code Here

            }
        }
        contentHeaderProperties.setDeliveryMode((byte) deliveryMode);
        contentHeaderProperties.setPriority((byte) priority);

        int size = payload.limit();
        ContentBody[] contentBodies = createContentBodies(payload);
        AMQFrame[] frames = new AMQFrame[2 + contentBodies.length];
        for (int i = 0; i < contentBodies.length; i++)
        {
            frames[2 + i] = ContentBody.createAMQFrame(_channelId, contentBodies[i]);
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.