AngleSharp by AngleSharp

<PackageReference Include="AngleSharp" Version="1.3.1" />

 WritableTextSource

public Encoding CurrentEncoding { get; set; }

Gets or sets the encoding to use.

public int Index { get; set; }

Gets or sets the current index of the insertation and read point.

public char this[int index] { get; }

Gets the character at the given position in the text buffer.

public int Length { get; }

Gets the length of the text buffer.

public string Text { get; }

Gets the full text buffer.

public WritableTextSource(string source)

Creates a new text source from a string. No underlying stream will be used.

public WritableTextSource(Stream baseStream, Encoding encoding = null)

Creates a new text source from a string. The underlying stream is used as an unknown data source.

public void Dispose()

Disposes the text source by freeing the underlying stream, if any.

public void InsertText(string content)

Inserts the given content at the current insertation mark. Moves the insertation mark.

public Task PrefetchAllAsync(CancellationToken cancellationToken)

Prefetches the whole stream by expanding the internal buffer.

public Task PrefetchAsync(int length, CancellationToken cancellationToken)

Prefetches the number of bytes by expanding the internal buffer.

public char ReadCharacter()

Reads the next character from the buffer or underlying stream, if any.

public string ReadCharacters(int characters)

Reads the upcoming numbers of characters from the buffer or underlying stream, if any.

public StringOrMemory ReadMemory(int characters)

public bool TryGetContentLength(out int length)

Gets the content length, if known.