/**
  * Replaces the specified {@linkplain Segment segment} in this output document with the specified
  * text.
  *
  * <p>Specifying a <code>null</code> argument to the <code>text</code> parameter is exactly
  * equivalent to specifying an empty string, and results in the segment being completely removed
  * from the output document.
  *
  * @param segment the segment to replace.
  * @param text the replacement text, or <code>null</code> to remove the segment.
  */
 public void replace(final Segment segment, final CharSequence text) {
   replace(segment.getBegin(), segment.getEnd(), text);
 }