示例#1
0
 public static int encodeData(ProtocolChunkedInput input, final Message message, Data data) {
   int count = 4 + 4;
   // encode entry protection in millis as the sign bit. Thus the max value
   // of millis is 2^31, which is more than enough
   int seconds = data.getTTLSeconds();
   seconds = data.isProtectedEntry() ? seconds | 0x80000000 : seconds & 0x7FFFFFFF;
   input.copyToCurrent(seconds);
   input.copyToCurrent(data.getLength());
   // the real data
   input.copyToCurrent(data.getData(), data.getOffset(), data.getLength());
   count += data.getLength();
   return count;
 }