code: void preProcessOperation(StreamSegmentSealOperation operation) throws StreamSegmentSealedException, StreamSegmentMergedException {
          ensureSegmentId(operation);
          if (this.merged) {
              // We do not allow any operation after merging (since after merging the Stream disappears).
              throw new StreamSegmentMergedException(this.name);
          }
  
          if (this.sealed) {
              // We do not allow re-sealing an already sealed stream.
              throw new StreamSegmentSealedException(this.name);
          }
  
          if (!this.recoveryMode) {
              // Assign entry StreamSegment Length.
              operation.setStreamSegmentOffset(this.length);
          }
      }
docs: Pre-processes a StreamSegmentSealOperation.
  After this method returns, the operation will have its SegmentLength property set to the current length of the Segment.
  
  @param operation The Operation.
  @throws StreamSegmentSealedException If the Segment is already sealed.
  @throws StreamSegmentMergedException If the Segment is merged into another.
  @throws IllegalArgumentException     If the operation is for a different Segment.