1 25 package org.archive.util.iterator; 26 27 import java.io.BufferedReader ; 28 import java.io.IOException ; 29 import java.util.logging.Logger ; 30 31 37 public class LineReadingIterator extends LookaheadIterator<String > { 38 private static final Logger logger = 39 Logger.getLogger(LineReadingIterator.class.getName()); 40 41 protected BufferedReader reader = null; 42 43 public LineReadingIterator(BufferedReader r) { 44 reader = r; 45 } 46 47 52 protected boolean lookahead() { 53 try { 54 next = this.reader.readLine(); 55 if(next == null) { 56 reader.close(); 58 } 59 return (next!=null); 60 } catch (IOException e) { 61 logger.warning(e.toString()); 62 return false; 63 } 64 } 65 } 66 | Popular Tags |