public long CountRowsUsingCursivelyArrayInput(CsvFile csvFile) { var visitor = new RowCountingVisitor(); CsvSyncInput.ForMemory(csvFile.FileData).Process(visitor); return(visitor.RowCount); }
public long CountRowsUsingCursivelyMemoryMappedFileInput(CsvFile csvFile) { var visitor = new RowCountingVisitor(); CsvSyncInput.ForMemoryMappedFile(csvFile.FullPath).Process(visitor); return(visitor.RowCount); }
public long CountRowsUsingCursivelyRaw(CsvFile csvFile) { var visitor = new RowCountingVisitor(); var tokenizer = new CsvTokenizer(); tokenizer.ProcessNextChunk(csvFile.FileData, visitor); tokenizer.ProcessEndOfStream(visitor); return(visitor.RowCount); }
public async Task <long> CountRowsUsingCursivelyAsyncFileStreamInput(CsvFile csvFile) { var visitor = new RowCountingVisitor(); using (var stream = new FileStream(csvFile.FullPath, FileMode.Open, FileAccess.Read, FileShare.Read, 4096, FileOptions.Asynchronous | FileOptions.SequentialScan)) { await CsvAsyncInput.ForStream(stream).ProcessAsync(visitor); } return(visitor.RowCount); }
public long CountRowsUsingCursivelyFileStreamInput(CsvFile csvFile) { var visitor = new RowCountingVisitor(); using (var stream = new FileStream(csvFile.FullPath, FileMode.Open, FileAccess.Read, FileShare.Read, 4096, FileOptions.SequentialScan)) { CsvSyncInput.ForStream(stream).Process(visitor); } return(visitor.RowCount); }