看不懂代码:
代码一:
type = _din.readInt(); // Type of operation to enact
//不能理解
if (type == INSERT)
{
// Insert the selected text at the specified position.
offset = _din.readInt();
value = _din.readUTF();
insert(value, offset);
}
else if (type == REMOVE)
{
// Remove characters at specified position
offset = _din.readInt();
count = _din.readInt();
remove(offset, count);
}
其中 _din如下定义
_bluetoothConnection = (StreamConnection)Connector.open( info[FIRST].toString(), Connector.READ_WRITE );
_din = _bluetoothConnection.openDataInputStream();
_dout = _bluetoothConnection.openDataOutputStream();
readInt的文档解释如下:
public final int readInt()
throws IOException
See the general contract of the readInt method of DataInput.
Bytes for this operation are read from the contained input stream.
Specified by:
readInt in interface DataInput
Returns:
the next four bytes of this input stream, interpreted as an int.