Class LineReader
Reads lines from a stream, handling CRLF, LF, and CR line endings, and optional line unfolding (continuation lines) per RFC 5322 (MIME) or RFC 5545/6350 (iCal/vCard).
Implements
Inherited Members
Namespace: DRIT.Mail.Rfc.Shared
Assembly: DRIT.Mail.dll
Syntax
public sealed class LineReader : IDisposable
Constructors
View SourceLineReader(Stream, Encoding?, LineFoldingMode, bool)
Initializes a new instance of the LineReader class.
Declaration
public LineReader(Stream stream, Encoding? encoding = null, LineFoldingMode foldingMode = LineFoldingMode.None, bool leaveOpen = false)
Parameters
| Type | Name | Description |
|---|---|---|
| Stream | stream | The stream to read from. |
| Encoding | encoding | The encoding used to decode bytes to strings. Defaults to UTF-8. |
| LineFoldingMode | foldingMode | The line folding (unfolding) mode to apply. |
| bool | leaveOpen | If true, the underlying stream is left open when this reader is disposed. |
Properties
View SourcePosition
Gets the approximate byte position within the underlying stream.
Declaration
public long Position { get; }
Property Value
| Type | Description |
|---|---|
| long |
Methods
View SourceDispose()
Processes the dispose data.
Declaration
public void Dispose()
ReadLine()
Reads a single (possibly unfolded) line from the stream. Returns null at EOF. The line terminator (CRLF, LF, or CR) is not included in the result.
Declaration
public string? ReadLine()
Returns
| Type | Description |
|---|---|
| string |
ReadLineBytes()
Reads a single raw line as bytes from the stream, without unfolding. Returns null at EOF. The line terminator is not included.
Declaration
public byte[]? ReadLineBytes()
Returns
| Type | Description |
|---|---|
| byte[] |
ReadLines()
Reads all remaining lines from the stream.
Declaration
public IReadOnlyList<string> ReadLines()
Returns
| Type | Description |
|---|---|
| IReadOnlyList<string> |