private GameRecord extractGameRecord(ProcessorContext context, DataInputStream dis)
      throws IOException {
    int accountId = dis.readInt();
    int productId = dis.readInt();
    context.setProductId(productId);
    int recordId = dis.readInt();
    int playDuration = dis.readInt();
    int scores = dis.readInt();
    String remark = dis.readUTF();
    int dataLen = dis.readInt();
    byte[] data = null;
    if (dataLen > 0) {
      data = new byte[dataLen];
      int readLen = 0;
      int curReadLen = 0;
      while (readLen < data.length) {
        curReadLen = dis.read(data, readLen, data.length - readLen);
        if (curReadLen > 0) {
          readLen += curReadLen;
        }
      }
    }

    GameRecord record = new GameRecord();
    record.setAccountId(accountId);
    record.setRecordId(recordId);
    record.setPlayDuration(playDuration);
    record.setScores(scores);
    record.setRemark(remark);
    record.setTime(new java.util.Date());
    record.setData(data);

    return record;
  }
 private void processCommandRead(ProcessorContext context, DataOutputStream dos)
     throws IOException {
   dos.writeInt(context.getHeadWrapper().getHead());
   GameRecord record = (GameRecord) context.getResult();
   if (record != null) {
     dos.writeInt(0);
     dos.writeInt(record.getRecordId());
     dos.writeInt(record.getPlayDuration());
     dos.writeInt(record.getScores());
     dos.writeUTF(record.getRemark());
     dos.writeUTF(DateFormatUtils.format(record.getTime(), "yyyy/MM/dd HH:mm:ss"));
     byte[] data = record.getData();
     if (data != null && data.length > 0) {
       dos.writeInt(data.length);
       dos.write(data, 0, data.length);
     } else {
       dos.writeInt(0);
     }
   } else {
     dos.writeInt(Constant.EC_RECORD_NOT_EXIST);
     dos.writeUTF("游戏记录不存在");
   }
 }