FlowedToText Class

A flowed text to text converter.

Definition

Namespace: MimeKit.Text
Assembly: MimeKit.Core (in MimeKit.Core.dll) Version: 5.0.0
C#
public class FlowedToText : TextConverter
Inheritance
Object    TextConverter    FlowedToText

Remarks

Unwraps the flowed text format described in rfc3676.

Example

C#
                    public static string GetUnflowedText (TextPart part)
{
    // Text with a "format=flowed" Content-Type parameter (rfc3676) uses soft line breaks
    // so that the text can be re-wrapped by the receiving client. Convert it into normal
    // text by joining the flowed lines back into paragraphs.
    if (!part.IsFlowed)
        return part.Text;

    var converter = new FlowedToText ();

    // The "delsp" parameter specifies whether the space at the end of each flowed line
    // should be removed when the lines are joined.
    if (part.ContentType.Parameters.TryGetValue ("delsp", out string? delsp))
        converter.DeleteSpace = delsp.Equals ("yes", StringComparison.OrdinalIgnoreCase);

    return converter.Convert (part.Text);
}
                  

Constructors

FlowedToText Initialize a new instance of the FlowedToText class.

Properties

DeleteSpace Get or set whether the trailing space on a wrapped line should be deleted.
DetectEncodingFromByteOrderMark Get or set whether the encoding of the input is detected from the byte order mark or determined by the InputEncoding property.
(Inherited from TextConverter)
Footer Get or set the text that will be appended to the end of the output.
(Inherited from TextConverter)
Header Get or set text that will be prepended to the beginning of the output.
(Inherited from TextConverter)
InputEncoding Get or set the input encoding.
(Inherited from TextConverter)
InputFormat Get the input format.
(Overrides TextConverterInputFormat)
InputStreamBufferSize Get or set the size of the input stream buffer.
(Inherited from TextConverter)
OutputEncoding Get or set the output encoding.
(Inherited from TextConverter)
OutputFormat Get the output format.
(Overrides TextConverterOutputFormat)
OutputStreamBufferSize Get or set the size of the output stream buffer.
(Inherited from TextConverter)

Methods

Convert(String) Convert text from the InputFormat to the OutputFormat.
(Inherited from TextConverter)
Convert(Stream, Stream) Convert the contents of source from the InputFormat to the OutputFormat and writes the resulting text to destination.
(Inherited from TextConverter)
Convert(Stream, TextWriter) Convert the contents of source from the InputFormat to the OutputFormat and uses the writer to write the resulting text.
(Inherited from TextConverter)
Convert(TextReader, TextWriter) Convert the contents of reader from the InputFormat to the OutputFormat and uses the writer to write the resulting text.
(Overrides TextConverterConvert(TextReader, TextWriter))
Convert(TextReader, Stream) Convert the contents of reader from the InputFormat to the OutputFormat and writes the resulting text to destination.
(Inherited from TextConverter)
Equals Determines whether the specified object is equal to the current object.
(Inherited from Object)
Finalize Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object)
GetHashCode Serves as the default hash function.
(Inherited from Object)
GetType Gets the Type of the current instance.
(Inherited from Object)
MemberwiseClone Creates a shallow copy of the current Object.
(Inherited from Object)
ToString Returns a string that represents the current object.
(Inherited from Object)

See Also