示例#1
0
 public static AffixConfig Read(Stream stream, AffixConfig.Builder builder = null)
 {
     using (var reader = new DynamicEncodingLineReader(stream, DefaultEncoding))
     {
         return(Read(reader, builder));
     }
 }
示例#2
0
 public static async Task <AffixConfig> ReadAsync(Stream stream, AffixConfig.Builder builder = null)
 {
     using (var reader = new DynamicEncodingLineReader(stream, DefaultEncoding))
     {
         return(await ReadAsync(reader, builder).ConfigureAwait(false));
     }
 }
示例#3
0
 public static async Task <List <string> > ReadLinesAsync(string filePath, Encoding defaultEncoding)
 {
     using (var stream = FileStreamEx.OpenAsyncReadFileStream(filePath))
         using (var reader = new DynamicEncodingLineReader(stream, defaultEncoding))
         {
             return(await reader.ReadLinesAsync().ConfigureAwait(false));
         }
 }
示例#4
0
 public static List <string> ReadLines(string filePath, Encoding defaultEncoding)
 {
     using (var stream = FileStreamEx.OpenReadFileStream(filePath))
         using (var reader = new DynamicEncodingLineReader(stream, defaultEncoding))
         {
             return(reader.ReadLines().ToList());
         }
 }
        public static async Task <IEnumerable <string> > ReadLinesAsync(string filePath, Encoding defaultEncoding)
        {
            if (filePath == null)
            {
                throw new ArgumentNullException(nameof(filePath));
            }

            using (var stream = FileStreamEx.OpenAsyncReadFileStream(filePath))
                using (var reader = new DynamicEncodingLineReader(stream, defaultEncoding ?? Encoding.UTF8))
                {
                    return(await reader.ReadLinesAsync().ConfigureAwait(false));
                }
        }
        public static List <string> ReadLines(string filePath, Encoding defaultEncoding)
        {
            if (filePath == null)
            {
                throw new ArgumentNullException(nameof(filePath));
            }

            using (var stream = FileStreamEx.OpenReadFileStream(filePath))
                using (var reader = new DynamicEncodingLineReader(stream, defaultEncoding ?? Encoding.UTF8))
                {
                    return(reader.ReadLines().ToList());
                }
        }