public ChoManifoldReader(Stream inStream, ChoManifoldRecordConfiguration configuration = null) { ChoGuard.ArgumentNotNull(inStream, "Stream"); Configuration = configuration; Init(); if (inStream is MemoryStream) { _textReader = new Lazy <TextReader>(() => new StreamReader(inStream)); } else { _textReader = new Lazy <TextReader>(() => { if (Configuration.DetectEncodingFromByteOrderMarks == null) { return(new StreamReader(inStream, Configuration.GetEncoding(inStream), false, Configuration.BufferSize)); } else { return(new StreamReader(inStream, Encoding.Default, Configuration.DetectEncodingFromByteOrderMarks.Value, Configuration.BufferSize)); } }); } _closeStreamOnDispose = true; }
public ChoManifoldReader(Stream inStream, ChoManifoldRecordConfiguration configuration = null) { ChoGuard.ArgumentNotNull(inStream, "Stream"); Configuration = configuration; Init(); _textReader = new StreamReader(inStream, Configuration.GetEncoding(inStream), false, Configuration.BufferSize); _closeStreamOnDispose = true; }
public ChoManifoldReader(string filePath, ChoManifoldRecordConfiguration configuration = null) { ChoGuard.ArgumentNotNullOrEmpty(filePath, "FilePath"); Configuration = configuration; Init(); _textReader = new StreamReader(ChoPath.GetFullPath(filePath), Configuration.GetEncoding(filePath), false, Configuration.BufferSize); _closeStreamOnDispose = true; }