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