@Override protected void doClose() throws IOException { lineIterator.close(); } }
@Override public void close() { try (Closeable ignore = this.resourceCloser) { super.close(); } catch (IOException e) { throw new RuntimeException(e); } } }
/** * Closes the iterator, handling null and ignoring exceptions. * * @param iterator the iterator to close */ public static void closeQuietly(LineIterator iterator) { if (iterator != null) { iterator.close(); } }
/** * Closes a {@code LineIterator} quietly. * * @param iterator The iterator to close, or {@code null}. * @deprecated As of 2.6 removed without replacement. Please use the try-with-resources statement or handle * suppressed exceptions manually. * @see Throwable#addSuppressed(java.lang.Throwable) */ @Deprecated public static void closeQuietly(final LineIterator iterator) { try { if (iterator != null) { iterator.close(); } } catch(final IOException e) { // Suppressed. } }
private LineIterator getNextLineIterator() { if (lineIterator != null) { lineIterator.close(); } final LineIterator iterator = lineIterators.next(); parser.startFileFromBeginning(); return iterator; }
close(); } catch (final IOException e) { ioe.addSuppressed(e);
LineIterator it = FileUtils.lineIterator(file, "UTF-8"); try { while (it.hasNext()) { String line = it.nextLine(); // do something with line } } finally { it.close(); }
close(); throw new IllegalStateException(ioe.toString());
/** * Closes the iterator, handling null and ignoring exceptions. * * @param iterator the iterator to close */ public static void closeQuietly(LineIterator iterator) { if (iterator != null) { iterator.close(); } }
/** * Closes the iterator, handling null and ignoring exceptions. * * @param iterator the iterator to close */ public static void closeQuietly(LineIterator iterator) { if (iterator != null) { iterator.close(); } }
@Override protected void doClose() throws IOException { lineIterator.close(); } }
/** * Closes the iterator, handling null and ignoring exceptions. * * @param iterator the iterator to close */ public static void closeQuietly(LineIterator iterator) { if (iterator != null) { iterator.close(); } }
@Override public void close() { try (Closeable ignore = this.resourceCloser) { super.close(); } catch (IOException e) { throw new RuntimeException(e); } } }
private LineIterator getNextLineIterator() { if (lineIterator != null) { lineIterator.close(); } final LineIterator iterator = lineIterators.next(); parser.startFileFromBeginning(); return iterator; }
@Override public void processAll() throws Exception { File listFile = new File(fileListPath); File dataFolder = new File(listFile.getParent(),"data"); LineIterator iterator = FileUtils.lineIterator(listFile); while(iterator.hasNext()){ File f = new File(dataFolder,iterator.nextLine()+".sgm"); String text = FileUtils.readFileToString(f); processDoc(text); } iterator.close(); }
@Override public void processAll() throws Exception { File listFile = new File(fileListPath); File dataFolder = new File(listFile.getParent(),"data"); LineIterator iterator = FileUtils.lineIterator(listFile); while(iterator.hasNext()){ File f = new File(dataFolder,iterator.nextLine()+".sgm"); String text = FileUtils.readFileToString(f); processDoc(text); } iterator.close(); }
LineIterator it = FileUtils.lineIterator(file); try { while (it.hasNext()) { String line = it.nextLine(); // do something with line } } finally { it.close(); }
LineIterator it = FileUtils.lineIterator(file, "UTF-8"); try { while (it.hasNext()) { String line = it.nextLine(); // do something with line } } finally { it.close(); }
LineIterator it = FileUtils.lineIterator(file, "UTF-8"); try { while (it.hasNext()) { String line = it.nextLine(); // do something with line } } finally { it.close(); }