ezvcard.io.text
Class FoldedLineReader

java.lang.Object
  extended by java.io.Reader
      extended by java.io.BufferedReader
          extended by ezvcard.io.text.FoldedLineReader
All Implemented Interfaces:
Closeable, Readable

public class FoldedLineReader
extends BufferedReader

Automatically unfolds lines of text as they are read.

Author:
Michael Angstadt

Field Summary
 
Fields inherited from class java.io.Reader
lock
 
Constructor Summary
FoldedLineReader(Reader reader)
          Creates a folded line reader.
FoldedLineReader(String text)
          Creates a folded line reader.
 
Method Summary
 Charset getEncoding()
          Gets the character encoding of the reader.
 int getLineNum()
          Gets the starting line number of the last unfolded line that was read.
 String readLine()
          Reads the next unfolded line.
 
Methods inherited from class java.io.BufferedReader
close, mark, markSupported, read, read, ready, reset, skip
 
Methods inherited from class java.io.Reader
read, read
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FoldedLineReader

public FoldedLineReader(Reader reader)
Creates a folded line reader.

Parameters:
reader - the reader object to wrap

FoldedLineReader

public FoldedLineReader(String text)
Creates a folded line reader.

Parameters:
text - the text to read
Method Detail

getLineNum

public int getLineNum()
Gets the starting line number of the last unfolded line that was read.

Returns:
the line number

getEncoding

public Charset getEncoding()
Gets the character encoding of the reader.

Returns:
the character encoding or null if none is defined

readLine

public String readLine()
                throws IOException
Reads the next unfolded line.

Overrides:
readLine in class BufferedReader
Returns:
the next unfolded line or null if EOF
Throws:
IOException - if there's a problem reading from the reader


Copyright © 2012-2014 Michael Angstadt. All Rights Reserved.