Class StreamParser
Incrementally emits complete top-level Links Notation records.
Namespace: Link.Foundation.Links.Notation
Assembly: Link.Foundation.Links.Notation.dll
Syntax
public sealed class StreamParser
Constructors
|
Edit this page
View Source
StreamParser()
Creates a stream backed by a default canonical parser.
Declaration
|
Edit this page
View Source
StreamParser(Parser)
Creates a stream backed by parser.
Declaration
public StreamParser(Parser parser)
Parameters
| Type |
Name |
Description |
| Parser |
parser |
|
Properties
|
Edit this page
View Source
Collect
Declaration
public bool Collect { get; set; }
Property Value
|
Edit this page
View Source
MaxBufferSize
The largest unresolved record accepted by the stream.
Declaration
public int MaxBufferSize { get; set; }
Property Value
|
Edit this page
View Source
Position
The point immediately after the last character written.
Declaration
public StreamPosition Position { get; }
Property Value
Methods
|
Edit this page
View Source
Drain()
Returns and forgets links retained since the previous call.
Declaration
public IReadOnlyList<Link<string>> Drain()
Returns
|
Edit this page
View Source
Finish()
Finishes the stream and returns all undrained links.
Declaration
public IReadOnlyList<Link<string>> Finish()
Returns
|
Edit this page
View Source
Finish(string)
Consumes a final chunk and finishes the stream.
Declaration
public IReadOnlyList<Link<string>> Finish(string chunk)
Parameters
| Type |
Name |
Description |
| string |
chunk |
|
Returns
|
Edit this page
View Source
ParseChunks(IEnumerable<string>, Parser?)
Lazily parses a sequence of chunks as a native enumerable.
Declaration
public static IEnumerable<Link<string>> ParseChunks(IEnumerable<string> chunks, Parser? parser = null)
Parameters
Returns
|
Edit this page
View Source
ParseChunksAsync(IAsyncEnumerable<string>, Parser?, CancellationToken)
Lazily parses an asynchronous sequence of chunks.
Declaration
public static IAsyncEnumerable<Link<string>> ParseChunksAsync(IAsyncEnumerable<string> chunks, Parser? parser = null, CancellationToken cancellationToken = default)
Parameters
Returns
|
Edit this page
View Source
Reset()
Reuses the parser while preserving its options and event handlers.
Declaration
public StreamParser Reset()
Returns
|
Edit this page
View Source
Write(string)
Consumes a chunk and returns links made complete by it.
Declaration
public IReadOnlyList<Link<string>> Write(string chunk)
Parameters
| Type |
Name |
Description |
| string |
chunk |
|
Returns
Events
|
Edit this page
View Source
LinkParsed
Raised once for every completed link.
Declaration
public event Action<Link<string>>? LinkParsed
Event Type