Hello. I'm using MINA 1.1.2

I have a question about ByteBuffer.allocate();

Let me show you code.

--
ByteBuffer msg = ByteBuffer.allocate( 9, false );
msg.setAutoExpand( true );

msg.put( (byte)0x01 );          // 1 byte
msg.putShort( (short)0x01 );            // 2 byte
msg.put( (byte)0x01 );          // 1 byte
msg.put( (byte)0x01 );          // 1 byte
msg.putInt( 0 );                        // 4 byte
msg.put( (byte)0x01 );          // 1 byte
msg.put( (byte)0x01 );          // 1 byte
msg.put( (byte)0x01 );          // 1 byte
msg.put( (byte)0x01 );          // 1 byte

logger.debug( msg.limit() );            // output is 16

but, ByteBuffer msg = ByteBuffer.allocate( 8, false );

logger.debug( msg.limit() );            // output is 13


what's the reason?

Reply via email to