Example #1
0
 public EagerParserChunker(CharReadable reader, IdType idType, Header header, Collector badCollector, Extractors extractors, int chunkSize, Configuration config, Decorator decorator)
 {
     this._chunkSize = chunkSize;
     this._decorator = decorator;
     this._seeker    = charSeeker(reader, config, true);
     this._parser    = new CsvInputParser(_seeker, config.delimiter(), idType, header, badCollector, extractors);
 }
Example #2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: static Header extractHeader(org.neo4j.csv.reader.CharReadable stream, Header.Factory headerFactory, IdType idType, Configuration config, org.neo4j.unsafe.impl.batchimport.input.Groups groups) throws java.io.IOException
        internal static Header ExtractHeader(CharReadable stream, Header.Factory headerFactory, IdType idType, Configuration config, Groups groups)
        {
            if (!headerFactory.Defined)
            {
                char[] firstLineBuffer = Readables.extractFirstLineFrom(stream);
                // make the chunk slightly bigger than the header to not have the seeker think that it's reading
                // a value bigger than its max buffer size
                ChunkImpl firstChunk = new ChunkImpl(copyOf(firstLineBuffer, firstLineBuffer.Length + 1));
                firstChunk.Initialize(firstLineBuffer.Length, stream.SourceDescription());
                CharSeeker firstSeeker = Seeker(firstChunk, config);
                return(headerFactory.Create(firstSeeker, config, idType, groups));
            }

            return(headerFactory.Create(null, null, null, null));
        }
Example #3
0
        internal CsvInputIterator(CharReadable stream, Decorator decorator, Header header, Configuration config, IdType idType, Collector badCollector, Extractors extractors, int groupId)
        {
            this._stream    = stream;
            this._decorator = decorator;
            this._groupId   = groupId;
            if (config.multilineFields())
            {
                // If we're expecting multi-line fields then there's no way to arbitrarily chunk the underlying data source
                // and find record delimiters with certainty. This is why we opt for a chunker that does parsing inside
                // the call that normally just hands out an arbitrary amount of characters to parse outside and in parallel.
                // This chunker is single-threaded, as it was previously too and keeps the functionality of multi-line fields.
                this._chunker = new EagerParserChunker(stream, idType, header, badCollector, extractors, 1_000, config, decorator);
//JAVA TO C# CONVERTER TODO TASK: Method reference constructor syntax is not converted by Java to C# Converter:
                this._realInputChunkSupplier = EagerCsvInputChunk::new;
            }
            else
            {
                this._chunker = new ClosestNewLineChunker(stream, config.bufferSize());
                this._realInputChunkSupplier = () => new LazyCsvInputChunk(idType, config.delimiter(), badCollector, extractors(config), _chunker.newChunk(), config, decorator, header);
            }
        }
Example #4
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: CsvInputIterator(org.neo4j.csv.reader.CharReadable stream, Decorator decorator, Header.Factory headerFactory, IdType idType, Configuration config, org.neo4j.unsafe.impl.batchimport.input.Groups groups, org.neo4j.unsafe.impl.batchimport.input.Collector badCollector, org.neo4j.csv.reader.Extractors extractors, int groupId) throws java.io.IOException
        internal CsvInputIterator(CharReadable stream, Decorator decorator, Header.Factory headerFactory, IdType idType, Configuration config, Groups groups, Collector badCollector, Extractors extractors, int groupId) : this(stream, decorator, ExtractHeader(stream, headerFactory, idType, config, groups), config, idType, badCollector, extractors, groupId)
        {
        }