private void ensureLogicalSizeWritten() {
    if (lastWrittenLogicalSize != logicalSize) {
      writeLogicalSize(logicalSize);
      lastWrittenLogicalSize = logicalSize;
    }
  }
private void ensureLogicalSizeWritten()