示例#1
0
        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;
        }
示例#2
0
        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;
        }
示例#3
0
        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;
        }