org.jamon.parser
Class PositionalPushbackReader

java.lang.Object
  extended by org.jamon.parser.PositionalPushbackReader

public class PositionalPushbackReader
extends java.lang.Object

A "pushback reader" which also tracks the current position in the file. Unlike PushbackReader, this class allows pushing back an EOF marker as well

Author:
ian

Constructor Summary
PositionalPushbackReader(org.jamon.api.TemplateLocation p_templateLocation, java.io.Reader p_reader)
           
PositionalPushbackReader(org.jamon.api.TemplateLocation p_templateLocation, java.io.Reader p_reader, int p_pushbackBufferSize)
           
 
Method Summary
 org.jamon.api.Location getCurrentNodeLocation()
          Get the location of the current node, as set by markNodeBeginning() or markNodeEnd()
 org.jamon.api.Location getLocation()
          Get the location of the character just read.
 org.jamon.api.Location getNextLocation()
          Get the location of the next character to be read (if there is one).
 boolean isLineStart()
           
 void markNodeBeginning()
          Mark that we are just starting a node.
 void markNodeEnd()
          Mark that we have just finished a node
 int read()
           
 void unread(int c)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PositionalPushbackReader

public PositionalPushbackReader(org.jamon.api.TemplateLocation p_templateLocation,
                                java.io.Reader p_reader)
Parameters:
p_templateLocation - The path to the resource being read.
p_reader - The underlying reader to use

PositionalPushbackReader

public PositionalPushbackReader(org.jamon.api.TemplateLocation p_templateLocation,
                                java.io.Reader p_reader,
                                int p_pushbackBufferSize)
Method Detail

read

public int read()
         throws java.io.IOException
Throws:
java.io.IOException

unread

public void unread(int c)
            throws java.io.IOException
Throws:
java.io.IOException

getLocation

public org.jamon.api.Location getLocation()
Get the location of the character just read.

Returns:
The current location (line and column numbers starting at 1)

getNextLocation

public org.jamon.api.Location getNextLocation()
Get the location of the next character to be read (if there is one).

Returns:
The location of the next character

isLineStart

public boolean isLineStart()
Returns:
True if the character just read was at the begining of a line

markNodeBeginning

public void markNodeBeginning()
Mark that we are just starting a node.


markNodeEnd

public void markNodeEnd()
Mark that we have just finished a node


getCurrentNodeLocation

public org.jamon.api.Location getCurrentNodeLocation()
Get the location of the current node, as set by markNodeBeginning() or markNodeEnd()

Returns:
The location of the current node


jamon