Exemplo n.º 1
0
        protected ReaderBase(BoundConfigurationBase <T> config, object context)
        {
            RowNumber     = 0;
            Configuration = config;
            Context       = context;

            var bufferSize = config.ReadBufferSizeHint;

            if (bufferSize == 0)
            {
                bufferSize = DEFAULT_BUFFER_SIZE;
            }

            Buffer  = new BufferWithPushback(config.MemoryPool, bufferSize);
            Partial = new Partial <T>(config.MemoryPool);

            SharedCharacterLookup =
                ReaderStateMachine.MakeCharacterLookup(
                    config.MemoryPool,
                    config.EscapedValueStartAndStop,
                    config.ValueSeparator,
                    config.EscapeValueEscapeChar,
                    config.CommentChar
                    );
        }
Exemplo n.º 2
0
        internal HeadersReader(
            BoundConfigurationBase <T> config,
            ReaderStateMachine.CharacterLookup charLookup,
            TextReader inner,
            BufferWithPushback buffer
            )
        {
            MemoryPool     = config.MemoryPool;
            BufferSizeHint = config.ReadBufferSizeHint;
            Columns        = config.DeserializeColumns;
            Inner          = inner;

            StateMachine =
                new ReaderStateMachine(
                    charLookup,
                    config.EscapedValueStartAndStop,
                    config.EscapeValueEscapeChar,
                    config.RowEnding,
                    ReadHeaders.Never
                    );

            Buffer = buffer;

            HeaderCount    = 0;
            PushBackLength = 0;
        }
Exemplo n.º 3
0
        internal RowEndingDetector(BoundConfigurationBase <T> config, ReaderStateMachine.CharacterLookup charLookup, TextReader inner)
        {
            Inner = inner;

            State =
                new ReaderStateMachine(
                    charLookup,
                    config.EscapedValueStartAndStop,
                    config.EscapeValueEscapeChar,
                    RowEndings.None,
                    ReadHeaders.Never
                    );

            MemoryPool = config.MemoryPool;

            BufferSizeHint = config.ReadBufferSizeHint;
            if (BufferSizeHint == 0)
            {
                BufferSizeHint = ReaderBase <T> .DEFAULT_BUFFER_SIZE;
            }

            BufferOwner = MemoryPool.Rent(BufferSizeHint);
            BufferStart = 0;
        }