code: public static boolean validate(InputStream in) throws IOException {
          final Map<String, AbstractDataMarshaller<?>> marshallerMap = generateMarshallerMap(false, Collections.EMPTY_LIST);
          marshallerMap.putAll(generateMarshallerMap(false, DEFAULT_MARSHALLERS));
  
          final GZIPInputStream gzipInputStream = new GZIPInputStream(in);
          try {
              MessageDigestInputStream messageDigestInputStream = new MessageDigestInputStream(gzipInputStream, CHECKSUM_ALGORITHM);
              CountingDataInputStream dIn = new CountingDataInputStream(messageDigestInputStream);
  
              checkHeader(dIn);
              deSerialize(dIn, marshallerMap, true, DUMMY_PROGRESS_LISTENER);
  
              byte[] checksumCalcualted = messageDigestInputStream.getDigest();
              final int checksumAvailable = dIn.read();
  
              byte[] checksumValue = new byte[CHECKSUM_ALGORITHM_LENGTH];
              if (checksumAvailable == -1) {
                  return false; //no stored checksum
              }
  
              int readBytes = dIn.read(checksumValue);
              if (readBytes == CHECKSUM_ALGORITHM_LENGTH) {
                  return Arrays.equals(checksumValue, checksumCalcualted);
              } else {
                  return false; //checksum length too short or too long
              }
          } catch (NoSuchAlgorithmException ex) {
              throw new IOException("Checksum algorithm not available", ex);
          } finally {
              gzipInputStream.close();
          }
      }
docs: explicitly validates the given xdata stream against the embedded checksum,
  if there is no checksum or the checksum does not correspond to the data,
  then false is returned. Otherwise true is returned.
  
  @param in
  @return