net.sf.sfac.file
Class LineReader

java.lang.Object
  extended by net.sf.sfac.file.LineReader
Direct Known Subclasses:
LineReaderFilteringHtml

public class LineReader
extends Object

Object wrapping a BufferedReader adding line peeking and counting.
It can:


Constructor Summary
LineReader(BufferedReader reader)
           
LineReader(Class<?> loader, String resourceName)
           
LineReader(File src)
           
LineReader(URL src)
           
 
Method Summary
 void close()
           
 int getLineIndex()
          Returns the index of the line returned if you currently call the peekLine() method.
static String getReaderEncoding()
           
 String getSourceName()
           
 String peekLine()
           
 String peekNextLine()
          Equivalent to calling readLine() and then peekLine().
 String readLine()
           
protected  String readLineImpl()
           
static void setReaderEncoding(String newReaderEncoding)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LineReader

public LineReader(File src)
           throws IOException
Throws:
IOException

LineReader

public LineReader(URL src)
           throws IOException
Throws:
IOException

LineReader

public LineReader(Class<?> loader,
                  String resourceName)
           throws IOException
Throws:
IOException

LineReader

public LineReader(BufferedReader reader)
           throws IOException
Throws:
IOException
Method Detail

getReaderEncoding

public static String getReaderEncoding()

setReaderEncoding

public static void setReaderEncoding(String newReaderEncoding)

peekLine

public String peekLine()
                throws IOException
Throws:
IOException

peekNextLine

public String peekNextLine()
                    throws IOException
Equivalent to calling readLine() and then peekLine().

Throws:
IOException

readLine

public String readLine()
                throws IOException
Throws:
IOException

readLineImpl

protected String readLineImpl()
                       throws IOException
Throws:
IOException

getSourceName

public String getSourceName()

getLineIndex

public int getLineIndex()
Returns the index of the line returned if you currently call the peekLine() method.


close

public void close()
           throws IOException
Throws:
IOException


Copyright © 2012. All Rights Reserved.