public static StringTextSource ReadFrom(string fileName) { Encoding encoding; var text = TextFileUtility.ReadAllText(fileName, out encoding); return(new StringTextSource(text, encoding)); }
public static StringTextSource ReadFrom(byte[] data) { Encoding encoding; var text = TextFileUtility.GetText(data, out encoding); return(new StringTextSource(text, encoding)); }
public static StringTextSource ReadFrom(Stream stream) { Encoding encoding; var text = TextFileUtility.GetText(stream, out encoding); return(new StringTextSource(text, encoding)); }
/// <summary> /// Writes the text from this document into a file. /// </summary> public static void WriteTextTo(this ITextSource source, string fileName) { if (source == null) { throw new ArgumentNullException("source"); } TextFileUtility.WriteText(fileName, source); }