/** * Returns the next line in the wrapped <code>Reader</code>. * * @return the next line from the input * @throws NoSuchElementException if there is no line to return */ @Override public String next() { return nextLine(); }
/** * Returns the next line in the wrapped <code>Reader</code>. * * @return the next line from the input * @throws NoSuchElementException if there is no line to return */ public Object next() { return nextLine(); }
protected Map<String, String> getMigrateMap() throws IOException { Map<String,String> map = new HashMap<String,String>(); InputStream inStream = getClass().getResourceAsStream( "/org/archive/crawler/migrate/H1toH3.map"); LineIterator iter = IOUtils.lineIterator(inStream, "UTF-8"); while(iter.hasNext()) { String[] fields = iter.nextLine().split("\\|"); map.put(fields[1], fields[0]); } inStream.close(); return map; }
LineIterator it = FileUtils.lineIterator(file, "UTF-8"); try { while (it.hasNext()) { String line = it.nextLine(); // do something with line } } finally { it.close(); }
public void run() { try (LineIterator lineIterator = IOUtils.lineIterator(in)) { while (lineIterator.hasNext()) { consumeLine(lineIterator.nextLine()); } } catch (Exception ignore) { } finally { completed = true; } }
private void assertLines(final List<String> lines, final LineIterator iterator) { try { for (int i = 0; i < lines.size(); i++) { final String line = iterator.nextLine(); assertEquals("nextLine() line " + i, lines.get(i), line); } assertFalse("No more expected", iterator.hasNext()); } finally { LineIterator.closeQuietly(iterator); } }
try { while (it.hasNext()) { String line = it.nextLine(); lineNum++; line = line.replaceAll("\\s", "");
double[] subsetArr = null; while (it.hasNext()) { String line = it.nextLine(); lineNum++; line = line.replaceAll("\\s", "");
/** * Uncomment properties. * * @param url Source to uncomment client properties for. * @return Temporary file with uncommented client properties. * @throws IOException In case of IO exception. */ private File uncommentProperties(URL url) throws IOException { InputStream in = url.openStream(); assertNotNull(in); LineIterator it = IOUtils.lineIterator(in, "UTF-8"); Collection<String> lines = new ArrayList<>(); while (it.hasNext()) lines.add(it.nextLine().replace("#ignite.client.", "ignite.client.")); IgniteUtils.closeQuiet(in); File tmp = File.createTempFile(UUID.randomUUID().toString(), "properties"); tmp.deleteOnExit(); FileUtils.writeLines(tmp, lines); return tmp; }
iterator.nextLine(); fail("Expected NoSuchElementException"); } catch (final NoSuchElementException expected) {
iterator.nextLine(); fail("Expected NoSuchElementException"); } catch (final NoSuchElementException expected) {
try{ while (it.hasNext()){ String line = it.nextLine(); if(line.matches("myRegEx")){ results.add(file);
@Override public String next() { return it.nextLine(); } @Override
/** * Returns the next line in the wrapped <code>Reader</code>. * * @return the next line from the input * @throws NoSuchElementException if there is no line to return */ public String next() { return nextLine(); }
/** * {@inheritDoc } */ @Override public String nextLine() { current = batchLineIterator.nextLine(); return current; }
/** * Returns the next line in the wrapped <code>Reader</code>. * * @return the next line from the input * @throws NoSuchElementException if there is no line to return */ public String next() { return nextLine(); }
protected Map<String, String> getMigrateMap() throws IOException { Map<String,String> map = new HashMap<String,String>(); InputStream inStream = getClass().getResourceAsStream( "/org/archive/crawler/migrate/H1toH3.map"); LineIterator iter = IOUtils.lineIterator(inStream, "UTF-8"); while(iter.hasNext()) { String[] fields = iter.nextLine().split("\\|"); map.put(fields[1], fields[0]); } inStream.close(); return map; }
public List<String> getLines(String resource) throws IOException { List<String> lines = new ArrayList<String>(); LineIterator it = IOUtils.lineIterator(openResource(resource), "UTF-8"); while(it.hasNext()){ String line = it.nextLine(); if(line != null && !line.isEmpty() && line.charAt(0) != '#'){ lines.add(line); } } return lines; } @Override
LineIterator it = FileUtils.lineIterator(file, "UTF-8"); try { while (it.hasNext()) { String line = it.nextLine(); // do something with line } } finally { it.close(); }