# Class BasicTextModel.InMemoryContent

java.lang.Object
jfx.incubator.scene.control.richtext.model.BasicTextModel.InMemoryContent

All Implemented Interfaces:
  `BasicTextModel.Content`

Enclosing class:
  `BasicTextModel`

public static class BasicTextModel.InMemoryContent extends Object implements BasicTextModel.Content
This content provides in-memory storage in an `ArrayList` of `String`s.

Since:
  24

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `InMemoryContent()`
  The constructor.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `String`
  `getText(int index)`
  Returns the text string for the specified paragraph index.
  `void`
  `insertLineBreak(int index, int offset)`
  Inserts a line break.
  `int`
  `insertTextSegment(int index, int offset, String text, StyleAttributeMap attrs)`
  This method is called to insert a single text segment at the given position.
  `boolean`
  `isWritable()`
  Determines whether this content is writable (i.e.
  `void`
  `removeRange(TextPos start, TextPos end)`
  Removes the specified range.
  `int`
  `size()`
  Returns the number of paragraphs in this content.

  ### Methods declared in class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### InMemoryContent

    public InMemoryContent()
    The constructor.

- ## Method Details

  - ### size

    public int size()
    Description copied from interface: `BasicTextModel.Content`
    Returns the number of paragraphs in this content.
    Specified by:
      `size` in interface `BasicTextModel.Content`
    Returns:
      the number paragraphs

  - ### getText

    public String getText(int index)
    Description copied from interface: `BasicTextModel.Content`
    Returns the text string for the specified paragraph index. The returned text string cannot be null and must not contain any control characters other than TAB. The caller should never attempt to ask for a paragraph outside of the valid range.
    Specified by:
      `getText` in interface `BasicTextModel.Content`
    Parameters:
      `index` - the paragraph index in the range (0...`BasicTextModel.Content.size()`)
    Returns:
      the text string or null

  - ### insertTextSegment

    public int insertTextSegment(int index, int offset, String text, StyleAttributeMap attrs)
    Description copied from interface: `BasicTextModel.Content`
    This method is called to insert a single text segment at the given position. The `BasicTextModel` guarantees that this method is only called when the content is writable.
    Specified by:
      `insertTextSegment` in interface `BasicTextModel.Content`
    Parameters:
      `index` - the paragraph index
      `offset` - the insertion offset within the paragraph
      `text` - the text to insert
      `attrs` - the style attributes
    Returns:
      the number of characters inserted

  - ### insertLineBreak

    public void insertLineBreak(int index, int offset)
    Description copied from interface: `BasicTextModel.Content`
    Inserts a line break. The `BasicTextModel` guarantees that this method is only called when the content is writable.
    Specified by:
      `insertLineBreak` in interface `BasicTextModel.Content`
    Parameters:
      `index` - the model index
      `offset` - the text offset

  - ### removeRange

    public void removeRange(TextPos start, TextPos end)
    Description copied from interface: `BasicTextModel.Content`
    Removes the specified range. The `BasicTextModel` guarantees that this method is only called when the content is writable, and that `start` precedes `end`.
    Specified by:
      `removeRange` in interface `BasicTextModel.Content`
    Parameters:
      `start` - the start of the region to be removed
      `end` - the end of the region to be removed, expected to be greater than the start position

  - ### isWritable

    public boolean isWritable()
    Description copied from interface: `BasicTextModel.Content`
    Determines whether this content is writable (i.e. supports modification).
    Specified by:
      `isWritable` in interface `BasicTextModel.Content`
    Returns:
      true if writable