예제 #1
0
 public Message(byte[] data) {
   buffer = ByteBuffer.allocate(headSize() + data.length);
   buffer.put(VERSION);
   buffer.putLong(Util.getCRC32(data));
   buffer.put(data);
   buffer.rewind();
 }
예제 #2
0
 public boolean valid() {
   return checksum()
       == Util.getCRC32(buffer.array(), buffer.arrayOffset() + headSize(), payloadSize());
 }