Java ByteBuffer class

Can someone explain me the behavior of the position property of the Java ByteBuffer class. I am currently porting Java classes to Xojo and these classes make extensive use of the ByteBuffer class.

My understanding is as follows. At the creation of the class position is set to zero. Each time we write in it the position property is incremented by a value corresponding to the size of the written data. When we read a data the position property is systematically reset to zero and once the reading is done is incremented by a value corresponding to the size of the read data.

Is this correct? I confess this is a bit confusing for me. Thanks for your lights

It should be like you wrote but I would like to ask you if you can provide the Java Code behind to have a look on it before I say something really seriously about it.

Sure. The code is public : Java code

In MAVLinkPacket.generateCRC I need to know the size of the payload. This is done by calling the size method of the MAVLinkPayload class. This method just returns the value of the position property.