Package org.apache.maven.doxia.util
Class ByLineReaderSource
- java.lang.Object
-
- org.apache.maven.doxia.util.ByLineReaderSource
-
- All Implemented Interfaces:
ByLineSource
public class ByLineReaderSource extends java.lang.Object implements ByLineSource
ByLineSource
default implementation
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.String
lastLine
holds the last line returned by getNextLine()private int
lineNumber
current line numberprivate java.lang.String
name
private java.io.LineNumberReader
reader
readerprivate boolean
ungetted
true
if ungetLine() was called and no getNextLine() was called
-
Constructor Summary
Constructors Constructor Description ByLineReaderSource(java.io.Reader in)
Creates the ByLineReaderSource.ByLineReaderSource(java.io.Reader in, java.lang.String name)
Constructor for ByLineReaderSource.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
close the source.int
getLineNumber()
getLineNumber.java.lang.String
getName()
getName.java.lang.String
getNextLine()
getNextLine.void
unget(java.lang.String s)
unget.void
ungetLine()
ungetLine.
-
-
-
Field Detail
-
reader
private java.io.LineNumberReader reader
reader
-
lineNumber
private int lineNumber
current line number
-
lastLine
private java.lang.String lastLine
holds the last line returned by getNextLine()
-
ungetted
private boolean ungetted
true
if ungetLine() was called and no getNextLine() was called
-
name
private java.lang.String name
-
-
Constructor Detail
-
ByLineReaderSource
public ByLineReaderSource(java.io.Reader in)
Creates the ByLineReaderSource.- Parameters:
in
- real source :)
-
ByLineReaderSource
public ByLineReaderSource(java.io.Reader in, java.lang.String name)
Constructor for ByLineReaderSource.
- Parameters:
in
- aReader
object.name
- aString
object.
-
-
Method Detail
-
getNextLine
public final java.lang.String getNextLine() throws ParseException
getNextLine.
- Specified by:
getNextLine
in interfaceByLineSource
- Returns:
- a
String
object. - Throws:
ParseException
- if any.
-
getName
public final java.lang.String getName()
getName.
- Specified by:
getName
in interfaceByLineSource
- Returns:
- a
String
object.
-
getLineNumber
public final int getLineNumber()
getLineNumber.
- Specified by:
getLineNumber
in interfaceByLineSource
- Returns:
- a int.
-
close
public final void close()
close the source.- Specified by:
close
in interfaceByLineSource
-
ungetLine
public final void ungetLine()
ungetLine.
This should throw a java.lang.IllegalStateException if called more than one time without calling getNextLine().- Specified by:
ungetLine
in interfaceByLineSource
-
unget
public final void unget(java.lang.String s)
unget.
- Specified by:
unget
in interfaceByLineSource
- Parameters:
s
- some text to push back to the parser. This should throw a java.lang.IllegalStateException if called more than one time without calling getNextLine().
-
-