@Test public void testHasNext() throws Exception { ClassPathResource reuters5250 = new ClassPathResource("/reuters/5250"); File f = reuters5250.getFile(); StreamLineIterator iterator = new StreamLineIterator.Builder(new FileInputStream(f)).setFetchSize(100).build(); int cnt = 0; while (iterator.hasNext()) { String line = iterator.nextSentence(); assertNotEquals(null, line); logger.info("Line: " + line); cnt++; } assertEquals(24, cnt); }
@Override public boolean hasNext() { try { return !buffer.isEmpty() || iterator.hasNext() || (currentReader != null && currentReader.ready()); } catch (IOException e) { return false; } }
StreamLineIterator implements SentenceIterator { @Override public boolean hasNext() { try { return !buffer.isEmpty() || iterator.hasNext() || (currentReader != null && currentReader.ready()); } catch (IOException e) { return false; } } }
StreamLineIterator implements SentenceIterator { @Override public boolean hasNext() { try { return !buffer.isEmpty() || iterator.hasNext() || (currentReader != null && currentReader.ready()); } catch (IOException e) { return false; } } private  StreamLineIterator(DocumentIterator iterator); }
StreamLineIterator implements SentenceIterator { @Override public boolean hasNext() { try { return !buffer.isEmpty() || iterator.hasNext() || (currentReader != null && currentReader.ready()); } catch (IOException e) { return false; } } private  StreamLineIterator(DocumentIterator iterator); @Override String nextSentence(); @Override boolean hasNext(); @Override void reset(); @Override void finish(); @Override SentencePreProcessor getPreProcessor(); @Override void setPreProcessor(SentencePreProcessor preProcessor); }
StreamLineIterator implements SentenceIterator { @Override public boolean hasNext() { try { return !buffer.isEmpty() || iterator.hasNext() || (currentReader != null && currentReader.ready()); } catch (IOException e) { return false; } } private  StreamLineIterator(DocumentIterator iterator); @Override String nextSentence(); @Override boolean hasNext(); @Override void reset(); @Override void finish(); @Override SentencePreProcessor getPreProcessor(); @Override void setPreProcessor(SentencePreProcessor preProcessor);  }