Пример #1
0
//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;
                }
            }
        }
 public override void Run()
 {
     try
     {
         using (InputChunk chunk = _data.newChunk())
         {
             while (_data.next(chunk))
             {
                 _control.assertHealthy();
                 int count = 0;
                 while (chunk.Next(_visitor))
                 {
                     count++;
                 }
                 _roughEntityCountProgress.add(count);
             }
         }
     }
     catch (IOException e)
     {
         _control.panic(e);
         throw new Exception(e);
     }
     catch (Exception e)
     {
         _control.panic(e);
         throw e;
     }
     finally
     {
         _visitor.Dispose();
     }
 }
Пример #3
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private DataFactory generateData(Header.Factory factory, org.apache.commons.lang3.mutable.MutableLong start, long count, long nodeCount, String headerString, String fileName, org.neo4j.unsafe.impl.batchimport.input.Groups groups) throws java.io.IOException
        private DataFactory GenerateData(Header.Factory factory, MutableLong start, long count, long nodeCount, string headerString, string fileName, Groups groups)
        {
            File   file   = Directory.file(fileName);
            Header header = factory.Create(charSeeker(wrap(headerString), COMMAS, false), COMMAS, IdType.Integer, groups);
            Distribution <string>    distribution    = new Distribution <string>(new string[] { "Token" });
            Deserialization <string> deserialization = new StringDeserialization(COMMAS);

            using (PrintWriter @out = new PrintWriter(new StreamWriter(file)), RandomEntityDataGenerator generator = new RandomEntityDataGenerator(nodeCount, count, toIntExact(count), Random.seed(), start.longValue(), header, distribution, distribution, 0, 0), InputChunk chunk = generator.NewChunk(), InputEntity entity = new InputEntity())
            {
                @out.println(headerString);
                while (generator.Next(chunk))
                {
                    while (chunk.Next(entity))
                    {
                        @out.println(convert(entity, deserialization, header));
                    }
                }
            }
            start.add(count);
            return(DataFactories.Data(InputEntityDecorators.NO_DECORATOR, Charsets.UTF_8, file));
        }