从类DataGrammPacket的javadoc的
的getLength():Returns the length of the data to be sent or the length of the data received.
的getData():Returns the data buffer. The data received or the data to be sent starts from the <code>offset</code> in the buffer, and runs for <code>length</code> long.
furthe你必须知道 使用setData():
Set the data buffer for this packet. This sets the
* data, length and offset of the packet.
*
* @param buf the buffer to set for this packet
*
* @param offset the offset into the data
*
* @param length the length of the data
* and/or the length of the buffer used to receive data
setData(byte[] buf, int offset, int length)
的构造函数也调用setData()
看源代码或javadocs ... – mre