code: void preProcessOperation(StreamSegmentTruncateOperation operation) throws BadOffsetException {
          ensureSegmentId(operation);
          if (operation.getStreamSegmentOffset() < this.startOffset || operation.getStreamSegmentOffset() > this.length) {
              String msg = String.format("Truncation Offset must be at least %d and at most %d, given %d.",
                                         this.startOffset, this.length, operation.getStreamSegmentOffset());
              throw new BadOffsetException(this.name, this.startOffset, operation.getStreamSegmentOffset(), msg);
          }
      }
docs: Pre-processes a StreamSegmentTruncateOperation.
  
  @param operation The Operation.
  @throws BadOffsetException              If the operation's Offset is not between the current StartOffset and current
  EndOffset (SegmentLength - 1).