* @return null or serialization measurements (depending on setting of doMeasurements)
* @throws IOException if the marker is invalid
*/
public SerializationMeasures serialize(AbstractCas cas, Object out, Marker trackingMark,
CompressLevel compressLevel, CompressStrat compressStrategy) throws IOException {
SerializationMeasures sm = (doMeasurements) ? new SerializationMeasures() : null;
CASImpl casImpl = (CASImpl) ((cas instanceof JCas) ? ((JCas)cas).getCas(): cas);
if (null != trackingMark && !trackingMark.isValid() ) {
throw new CASRuntimeException(
CASRuntimeException.INVALID_MARKER, new String[] { "Invalid Marker." });
}