コード例 #1
0
        public static StringTextSource ReadFrom(string fileName)
        {
            Encoding encoding;
            var      text = TextFileUtility.ReadAllText(fileName, out encoding);

            return(new StringTextSource(text, encoding));
        }
コード例 #2
0
        public static StringTextSource ReadFrom(byte[] data)
        {
            Encoding encoding;
            var      text = TextFileUtility.GetText(data, out encoding);

            return(new StringTextSource(text, encoding));
        }
コード例 #3
0
        public static StringTextSource ReadFrom(Stream stream)
        {
            Encoding encoding;
            var      text = TextFileUtility.GetText(stream, out encoding);

            return(new StringTextSource(text, encoding));
        }
コード例 #4
0
 /// <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);
 }