private static byte[] readCheckedBytes(byte[] buffer,int dataSize) throws InvalidProtocolBufferNanoException {
  CheckedMessage wrapper=new CheckedMessage();
  MessageNano.mergeFrom(wrapper,buffer,0,dataSize);
  CRC32 checksum=new CRC32();
  checksum.update(wrapper.payload);
  if (wrapper.checksum != checksum.getValue()) {
    throw new InvalidProtocolBufferNanoException("checksum does not match");
  }
  return wrapper.payload;
}

private static byte [ ] readCheckedBytes ( byte [ ] buffer , int dataSize ) throws InvalidProtocolBufferNanoException { CheckedMessage wrapper = new CheckedMessage ( ) ; MessageNano . mergeFrom ( wrapper , buffer , 0 , dataSize ) ; CRC32 checksum = new CRC32 ( ) ; checksum . update ( wrapper . payload ) ; if ( wrapper . checksum != checksum . getValue ( ) ) { throw new InvalidProtocolBufferNanoException ( "checksum does not match" ) ; } return wrapper . payload ; }
unwrap a proto message from a checkedmessage , verifying the checksum .
