0

我有一个 IOBuffer,它接收一个包含两种数据类型(Object 和 Long)的 InputBuffer。我不能同时读取这两种数据类型。

protected boolean doDecode(IoSession session, IoBuffer in, ProtocolDecoderOutput out) throws Exception
{
    String cName = (String)in.getObject();
    HashMap<String, Long> backupControllers = (HashMap<String, Long>)in.getObject();
    long controllerCapacity = in.getLong();
    controllerInfo request = new controllerInfo(cName, backupControllers, controllerCapacity); // this is object data type

    long controllerCurrentLoad = in.getLong(); //this is long data type
    request.setControllerLoad(controllerCurrentLoad);

    out.write(request);
    return false;
}

该功能不起作用,我无法读取缓冲区。

4

0 回答 0