/** * @deprecated Use instead {@link org.apache.commons.io.IOUtils#lineIterator(java.io.Reader)} */ @Deprecated public static LineIterator lineIterator(Reader reader) { return org.apache.commons.io.IOUtils.lineIterator(reader); }
/** * @deprecated Use instead {@link org.apache.commons.io.IOUtils#lineIterator(java.io.InputStream, String)} */ @Deprecated public static LineIterator lineIterator(InputStream input, String encoding) throws IOException { return org.apache.commons.io.IOUtils.lineIterator(input, encoding); }
try { in = openInputStream(file); return IOUtils.lineIterator(in, encoding); } catch (final IOException | RuntimeException ex) { try {
public boolean detectWhetherAppIsFramework(File appDir) throws AndrolibException { File publicXml = new File(appDir, "res/values/public.xml"); if (! publicXml.exists()) { return false; } Iterator<String> it; try { it = IOUtils.lineIterator(new FileReader(new File(appDir, "res/values/public.xml"))); } catch (FileNotFoundException ex) { throw new AndrolibException( "Could not detect whether app is framework one", ex); } it.next(); it.next(); return it.next().contains("0x01"); }
return lineIterator(input, Charsets.toCharset(encoding));
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; }
@Override public Optional<CloseableIterator<String>> readFileSource(int fileRef) { ensureInitialized(); File file = delegate.readFileSource(fileRef); if (file == null) { return Optional.empty(); } try { return Optional.of(new CloseableLineIterator(IOUtils.lineIterator(FileUtils.openInputStream(file), UTF_8))); } catch (IOException e) { throw new IllegalStateException("Fail to traverse file: " + file, e); } }
try { in = openInputStream(file); return IOUtils.lineIterator(in, encoding); } catch (IOException ex) { IOUtils.closeQuietly(in);
@Override public LineIterator next() { if (!hasNext()) { throw new NoSuchElementException(); } final T object = iterator.next(); try { return IOUtils.lineIterator(wrapObjectStream(object, openObjectStream(object)), StandardCharsets.UTF_8); } catch (Exception e) { LOG.error( e, "Exception reading object[%s]", object ); throw Throwables.propagate(e); } } },
public void run() { try (LineIterator lineIterator = IOUtils.lineIterator(in)) { while (lineIterator.hasNext()) { consumeLine(lineIterator.nextLine()); } } catch (Exception ignore) { } finally { completed = true; } }
@SuppressWarnings("unchecked") public Iterator<D> downloadFile(String file) throws IOException { log.info("Beginning to download gzip compressed file: " + file); try { InputStream inputStream = this.fileBasedExtractor.getCloser().register(this.fileBasedExtractor.getFsHelper().getFileStream(file)); Iterator<D> fileItr = (Iterator<D>) IOUtils.lineIterator(new GZIPInputStream(inputStream), ConfigurationKeys.DEFAULT_CHARSET_ENCODING); if (this.fileBasedExtractor.isShouldSkipFirstRecord() && fileItr.hasNext()) { fileItr.next(); } return fileItr; } catch (FileBasedHelperException e) { throw new IOException("Exception while downloading file " + file + " with message " + e.getMessage(), e); } } }
@SuppressWarnings("unchecked") public Iterator<D> downloadFile(String file) throws IOException { log.info("Beginning to download file: " + file); try { InputStream inputStream = this.fileBasedExtractor.getCloser().register(this.fileBasedExtractor.getFsHelper().getFileStream(file)); Iterator<D> fileItr = (Iterator<D>) IOUtils.lineIterator(inputStream, ConfigurationKeys.DEFAULT_CHARSET_ENCODING); if (this.fileBasedExtractor.isShouldSkipFirstRecord() && fileItr.hasNext()) { fileItr.next(); } return fileItr; } catch (FileBasedHelperException e) { throw new IOException("Exception while downloading file " + file + " with message " + e.getMessage(), e); } } }
LineIterator it = IOUtils.lineIterator(reader); DecimalFormat format = (DecimalFormat) NumberFormat.getInstance(Locale.US); format.setParseBigDecimal(true);
/** * 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; }
StringInputRowParser parser = mapper.readValue(parserJson, StringInputRowParser.class); LineIterator iter = IOUtils.lineIterator(inputDataStream, "UTF-8"); List<AggregatorFactory> aggregatorSpecs = mapper.readValue( aggregators,
dos.write(sb.toString().getBytes()); dos.flush(); Producer p = new Producer(IOUtils.lineIterator(new FileReader(imageList))); Thread pThread = new Thread(p); pThread.start();
dos.write(sb.toString().getBytes()); dos.flush(); Producer p = new Producer(IOUtils.lineIterator(new FileReader(imageList))); Thread pThread = new Thread(p); pThread.start();
double count = 0; try { LineIterator lineIt = IOUtils.lineIterator(new FileReader(infile));
double count = 0; try { LineIterator lineIt = IOUtils.lineIterator(new FileReader(infile));
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; }