//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: public synchronized boolean next(org.neo4j.unsafe.impl.batchimport.input.InputChunk chunk) throws java.io.IOException public override bool Next(InputChunk chunk) { lock (this) { while (true) { if (_current == null) { //JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops: if (!_source.hasNext()) { return(false); } //JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops: Data data = _source.next().create(_config); _current = new CsvInputIterator(new MultiReadable(data.Stream()), data.Decorator(), _headerFactory, _idType, _config, _groups, _badCollector, Extractors(_config), _groupId++); } if (_current.next(( CsvInputChunkProxy )chunk)) { return(true); } _current.Dispose(); _current = null; } } }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private long[] sample(Iterable<DataFactory> dataFactories, Header.Factory headerFactory, System.Func<org.neo4j.values.storable.Value[], int> valueSizeCalculator, System.Func<org.neo4j.unsafe.impl.batchimport.input.InputEntity, int> additionalCalculator) throws java.io.IOException private long[] Sample(IEnumerable <DataFactory> dataFactories, Header.Factory headerFactory, System.Func <Value[], int> valueSizeCalculator, System.Func <InputEntity, int> additionalCalculator) { long[] estimates = new long[4]; // [entity count, property count, property size, labels (for nodes only)] using (CsvInputChunkProxy chunk = new CsvInputChunkProxy()) { // One group of input files int groupId = 0; foreach (DataFactory dataFactory in dataFactories) // one input group { groupId++; Header header = null; Data data = dataFactory.Create(_config); RawIterator <CharReadable, IOException> sources = data.Stream(); while (sources.HasNext()) { using (CharReadable source = sources.Next()) { if (header == null) { // Extract the header from the first file in this group header = extractHeader(source, headerFactory, _idType, _config, _groups); } using (CsvInputIterator iterator = new CsvInputIterator(source, data.Decorator(), header, _config, _idType, EMPTY, extractors(_config), groupId), InputEntity entity = new InputEntity()) { int entities = 0; int properties = 0; int propertySize = 0; int additional = 0; while (iterator.Position() < _estimateSampleSize && iterator.Next(chunk)) { for ( ; chunk.Next(entity); entities++) { properties += entity.PropertyCount(); propertySize += calculatePropertySize(entity, valueSizeCalculator); additional += additionalCalculator(entity); } } if (entities > 0) { long entityCountInSource = ( long )((( double )source.Length() / iterator.Position()) * entities); estimates[0] += entityCountInSource; estimates[1] += ( long )((( double )properties / entities) * entityCountInSource); estimates[2] += ( long )((( double )propertySize / entities) * entityCountInSource); estimates[3] += ( long )((( double )additional / entities) * entityCountInSource); } } } } } } return(estimates); }
public override void Close() { try { if (_current != null) { _current.Dispose(); } _current = null; } catch (IOException e) { throw new UncheckedIOException(e); } }