cc.plural.jsonij.parser
Class BaseReaderParser

java.lang.Object
  extended by cc.plural.jsonij.parser.BaseReaderParser
All Implemented Interfaces:
ReaderParser
Direct Known Subclasses:
JPathParser.JPathReader, JSONReader

public abstract class BaseReaderParser
extends Object
implements ReaderParser

Author:
openecho

Field Summary
protected  boolean hasPeeked
           
protected  int peekValue
           
protected  Position position
           
 
Constructor Summary
BaseReaderParser()
           
BaseReaderParser(Reader reader)
           
 
Method Summary
 void close()
           
 int getLineNumber()
           
 Position getPosition()
           
 int getPositionNumber()
           
protected  void handleNewLine()
           
 boolean hasPeeked()
           
 boolean isHasPeeked()
          Only here for POJO reasons.
 int peek()
           
 int read()
           
protected abstract  int readNext()
          Reads from the reader.
 void setHasPeeked(boolean hasPeeked)
           
protected  Position setPosition(Position position)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

peekValue

protected int peekValue

hasPeeked

protected boolean hasPeeked

position

protected Position position
Constructor Detail

BaseReaderParser

public BaseReaderParser()

BaseReaderParser

public BaseReaderParser(Reader reader)
Method Detail

getPosition

public Position getPosition()
Specified by:
getPosition in interface ReaderParser
Returns:
the position

setPosition

protected Position setPosition(Position position)
Parameters:
position - the position to set

isHasPeeked

public boolean isHasPeeked()
Only here for POJO reasons.

Specified by:
isHasPeeked in interface ReaderParser
Returns:
hasPeeked()
See Also:
hasPeeked()

hasPeeked

public boolean hasPeeked()
Specified by:
hasPeeked in interface ReaderParser

setHasPeeked

public void setHasPeeked(boolean hasPeeked)
Specified by:
setHasPeeked in interface ReaderParser

getLineNumber

public int getLineNumber()
Specified by:
getLineNumber in interface ReaderParser

getPositionNumber

public int getPositionNumber()
Specified by:
getPositionNumber in interface ReaderParser

peek

public int peek()
         throws IOException,
                ParserException
Specified by:
peek in interface ReaderParser
Throws:
IOException
ParserException

read

public int read()
         throws IOException,
                ParserException
Specified by:
read in interface ReaderParser
Throws:
IOException
ParserException

readNext

protected abstract int readNext()
                         throws IOException,
                                ParserException
Reads from the reader.

Parameters:
targetReader - The reader to be read from.
Returns:
The read byte if found otherwise -1 if the end of the stream is reached.
Throws:
IOException - Java IO Exception.
ParserException

close

public void close()
Specified by:
close in interface ReaderParser

handleNewLine

protected void handleNewLine()
                      throws IOException
Throws:
IOException

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2012. All Rights Reserved.