edu.harvard.hul.ois.mets.helper
Class MetsReader

java.lang.Object
  extended byedu.harvard.hul.ois.mets.helper.MetsReader

public class MetsReader
extends java.lang.Object

Reader to de-serialize a METS file to an in-memory representation.


Constructor Summary
MetsReader(java.io.InputStream in)
          Instantiate a MetsReader object with an open input stream.
MetsReader(java.io.InputStream in, boolean debug)
          Instantiate a MetsReader object with an open input stream.
 
Method Summary
 Token atContent()
          Determine if the current parser token is child content.
 boolean atEnd(java.lang.String localName)
          Determine if the current parser token is an end tag.
 boolean atStart()
          Determine if the current parser token is an start tag.
 boolean atStart(java.lang.String localName)
          Determine if the current parser token is an start tag.
 boolean atText()
          Determine if the current parser token is text.
 void getEnd(java.lang.String localName)
          Consume an end tag.
 Token getStart()
          Consume a start tag.
 Token getStart(java.lang.String localName)
          Consume a start tag.
 java.lang.String getText()
          Consume text content.
 boolean isDebug()
          Return status of the reader debug flag.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MetsReader

public MetsReader(java.io.InputStream in)
           throws MetsException
Instantiate a MetsReader object with an open input stream.

Parameters:
in - Open input stream
Throws:
MetsException - I/O exception

MetsReader

public MetsReader(java.io.InputStream in,
                  boolean debug)
           throws MetsException
Instantiate a MetsReader object with an open input stream.

Parameters:
in - Open input stream
debug - Debug flag
Throws:
MetsException - I/O exception
Method Detail

atContent

public Token atContent()
                throws MetsException
Determine if the current parser token is child content.

Returns:
True if current token is child content
Throws:
MetsException - Parsing exception

atEnd

public boolean atEnd(java.lang.String localName)
              throws MetsException
Determine if the current parser token is an end tag.

Parameters:
localName - Element local name
Returns:
True if current token is an end tag
Throws:
MetsException - Parsing exception

atStart

public boolean atStart()
                throws MetsException
Determine if the current parser token is an start tag.

Returns:
True if current token is an start tag
Throws:
MetsException - Parsing exception

atStart

public boolean atStart(java.lang.String localName)
                throws MetsException
Determine if the current parser token is an start tag.

Parameters:
localName - Element local name
Returns:
True if current token is an start tag
Throws:
MetsException - Parsing exception

atText

public boolean atText()
               throws MetsException
Determine if the current parser token is text.

Returns:
True if current token is text
Throws:
MetsException - Parsing exception

getEnd

public void getEnd(java.lang.String localName)
            throws MetsException
Consume an end tag.

Parameters:
localName - Local element name
Throws:
MetsException - Parsing exception

getStart

public Token getStart()
               throws MetsException
Consume a start tag.

Returns:
Element token
Throws:
MetsException - Parsing exception

getStart

public Token getStart(java.lang.String localName)
               throws MetsException
Consume a start tag.

Parameters:
localName - Local element name
Returns:
Element token
Throws:
MetsException - Parsing exception

getText

public java.lang.String getText()
                         throws MetsException
Consume text content.

Returns:
Text
Throws:
MetsException - Parsing exception

isDebug

public boolean isDebug()
Return status of the reader debug flag.

Returns:
True if the debug flag is set