epfl.io
Class TagReader

java.lang.Object
  |
  +--java.io.Reader
        |
        +--epfl.io.TagReader

public class TagReader
extends java.io.Reader

A simple tag reader.
tags have the form <tagName> ... </tagName>


Constructor Summary
TagReader(java.io.Reader in)
          Constructs a new tag reader on the underlying reader
 
Method Summary
 void close()
           
 void mark(int readAheadLimit)
           
 boolean markSupported()
           
 int read()
           
 int read(char[] cbuf)
           
 int read(char[] cbuf, int off, int len)
           
 boolean readBoolean()
          Reads a boolean = true|false
 boolean readBoolean(java.lang.String tag)
          Reads a boolean tag
 double readDouble()
          Reads a double
 double readDouble(java.lang.String tag)
          Reads a double tag
 void readEndTag(java.lang.String tag)
          Reads in stream until the end tag is consumed.
 java.lang.String readIdent()
          Reads an identifier
 java.lang.String readIdent(java.lang.String tag)
          Reads an identifier tag
 int readInt()
          Reads an integer
 int readInt(java.lang.String tag)
          Reads a integer tag
 long readLong()
          Reads a long integer
 long readLong(java.lang.String tag)
          Reads a long integer tag
 void readStartTag(java.lang.String tag)
          Reads in stream until the start tag is consumed
the start tag has the form <tag>
 boolean ready()
           
 void reset()
           
 long skip(long n)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TagReader

public TagReader(java.io.Reader in)
          throws java.io.IOException
Constructs a new tag reader on the underlying reader
Method Detail

close

public void close()
           throws java.io.IOException
Overrides:
close in class java.io.Reader

mark

public void mark(int readAheadLimit)
          throws java.io.IOException
Overrides:
mark in class java.io.Reader

markSupported

public boolean markSupported()
Overrides:
markSupported in class java.io.Reader

read

public int read()
         throws java.io.IOException
Overrides:
read in class java.io.Reader

read

public int read(char[] cbuf)
         throws java.io.IOException
Overrides:
read in class java.io.Reader

read

public int read(char[] cbuf,
                int off,
                int len)
         throws java.io.IOException
Overrides:
read in class java.io.Reader

ready

public boolean ready()
              throws java.io.IOException
Overrides:
ready in class java.io.Reader

reset

public void reset()
           throws java.io.IOException
Overrides:
reset in class java.io.Reader

skip

public long skip(long n)
          throws java.io.IOException
Overrides:
skip in class java.io.Reader

readStartTag

public void readStartTag(java.lang.String tag)
                  throws java.io.IOException
Reads in stream until the start tag is consumed
the start tag has the form <tag>
Parameters:
tag - the tag name

readEndTag

public void readEndTag(java.lang.String tag)
                throws java.io.IOException
Reads in stream until the end tag is consumed.
the end tag has the form </tag>
Parameters:
tag - the tag name

readBoolean

public boolean readBoolean(java.lang.String tag)
                    throws java.io.IOException
Reads a boolean tag
Parameters:
tag - the tag name
Throws:
java.io.IOException - if the tag read does not contain a boolean or if the tag is ill formed

readBoolean

public boolean readBoolean()
                    throws java.io.IOException
Reads a boolean = true|false
Throws:
java.io.IOException - if next token is not a boolean

readLong

public long readLong(java.lang.String tag)
              throws java.io.IOException
Reads a long integer tag
Parameters:
tag - the tag name
Throws:
java.io.IOException - if the tag read does not contain a long integer or if the tag is ill formed

readLong

public long readLong()
              throws java.io.IOException
Reads a long integer
Throws:
java.io.IOException - if next token is not a long integer

readInt

public int readInt(java.lang.String tag)
            throws java.io.IOException
Reads a integer tag
Parameters:
tag - the tag name
Throws:
java.io.IOException - if the tag read does not contain an integer or if the tag is ill formed

readInt

public int readInt()
            throws java.io.IOException
Reads an integer
Throws:
java.io.IOException - if next token is not an integer

readDouble

public double readDouble(java.lang.String tag)
                  throws java.io.IOException
Reads a double tag
Parameters:
tag - the tag name
Throws:
java.io.IOException - if the tag read does not contain a double or if the tag is ill formed

readDouble

public double readDouble()
                  throws java.io.IOException
Reads a double
Throws:
java.io.IOException - if next token is not a double

readIdent

public java.lang.String readIdent(java.lang.String tag)
                           throws java.io.IOException
Reads an identifier tag
Parameters:
tag - the tag name
Throws:
java.io.IOException - if the tag read does not contain an identifier or if the tag is ill formed

readIdent

public java.lang.String readIdent()
                           throws java.io.IOException
Reads an identifier
Throws:
java.io.IOException - if next token is not an identifier