code: public static <PS, SEG, S> ReadOnlyStyledDocument<PS, SEG, S> fromSegment(SEG segment,  PS paragraphStyle, S style, SegmentOps<SEG, S> segmentOps) {
          Paragraph<PS, SEG, S> content = new Paragraph<PS, SEG, S>(paragraphStyle, segmentOps, segment, style);
          List<Paragraph<PS, SEG, S>> res = Collections.singletonList(content);
          return new ReadOnlyStyledDocument<>(res);
      }
docs: Creates a {@link ReadOnlyStyledDocument} from the given segment.
  
  @param segment the only segment in the only paragraph in the document
  @param paragraphStyle the paragraph style to use for each paragraph in the returned document
  @param style the style to use for each segment in the document
  @param segmentOps the operations object that can create a segment froma given text
  @param <PS> The type of the paragraph style.
  @param <SEG> The type of the segments in the paragraph (e.g. {@link String}).
  @param <S> The type of the style of individual segments.