@Override
  public void write(DataOutput stream) throws IOException {
    long startOffset = StreamUtil.getOffset(stream);
    super.write(stream);
    long offset = StreamUtil.getOffset(stream);
    long realLength = offset - startOffset;
    long expectedLength = myLength.getValue();
    assert realLength == expectedLength : "Actual length does not match calculated length for " + getName() +
                                          ": expected " + expectedLength + ", actual " + realLength + ", sizeInBytes() " + sizeInBytes();
  }
@Override
  public void write(DataOutput stream)