Package org.apache.directmemory.memory.buffer

Examples of org.apache.directmemory.memory.buffer.MemoryBuffer.writerIndex()


                continue;
            }

            p = instanciatePointer( buffer, allocator.getNumber(), expiresIn, NEVER_EXPIRES );

            buffer.writerIndex( 0 );
            buffer.writeBytes( payload );

            used.addAndGet( payload.length );

        }
View Full Code Here


        final byte[] allocatedPayload1 = MemoryTestUtils.generateRandomPayload( size1 );
        final Pointer<Object> allocatedPointer1 = mms.allocate( Object.class, allocatedPayload1.length, -1, -1 );
        Assert.assertNotNull( allocatedPointer1 );
        final MemoryBuffer buffer1 = allocatedPointer1.getMemoryBuffer();
        Assert.assertNotNull( buffer1 );
        Assert.assertEquals( 0, buffer1.writerIndex() );
        Assert.assertEquals( size1, buffer1.capacity() );
        Assert.assertEquals( size1, buffer1.capacity() );
        buffer1.writeBytes( allocatedPayload1 );
        Assert.assertEquals( new String( allocatedPayload1 ), new String( mms.retrieve( allocatedPointer1 ) ) );
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.