use of org.neo4j.csv.reader.CharReadableChunker.ChunkImpl in project neo4j by neo4j.
the class CsvInputIterator method extractHeader.
static Header extractHeader(CharReadable stream, Header.Factory headerFactory, IdType idType, Configuration config, Groups groups, Monitor monitor) throws IOException {
if (!headerFactory.isDefined()) {
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, monitor);
}
return headerFactory.create(null, null, null, null, monitor);
}
Aggregations