noope.input
Class StringBlockReader

java.lang.Object
  |
  +--noope.input.BlockReader
        |
        +--noope.input.StringBlockReader
Direct Known Subclasses:
FileBlockReader

public class StringBlockReader
extends BlockReader

A BlockReader that reads in its data from a String.

Version:
June-2001
Author:
Paul Evans

Constructor Summary
StringBlockReader(java.lang.String s)
           
 
Method Summary
 BlockReaderLocation getBlockLocation()
          Similar to getEntryLocation
 BlockReaderContext getContext(BlockReaderLocation loc)
          Converts a Location into a fully-qualified Context object.
 BlockReaderLocation getEntryLocation()
          Returns a BlockReaderLocation object describing the current Entry location.
 java.lang.String getHeader()
          Returns the header of this block.
 BlockReader getNextBlock()
          Returns the next subblock, which is an instance of BlockReader.
 java.lang.String[] getNextEntry()
          Returns the next Entry, as a string array.
 java.lang.String getParameter()
          Returns the parameter of this block.
 boolean hasMoreBlocks()
          Returns TRUE if this block has more Blocks after the one that was last returned
 boolean hasMoreEntries()
          Returns TRUE if this block has more Entries after the one that was last returned
 BlockReader peekNextBlock()
          This method acts as getNextBlock() but does not advance position
 java.lang.String[] peekNextEntry()
          This method acts as getNextEntry() but does not advance position
 void seekFirstBlock()
          Resets the subblock position to the beginning, so that the next call to getNextBlock() will return the first subblock (unless there are no subblocks, in which case an exception is thrown, of course.
 void seekFirstEntry()
          Moves the "entry pointer" back to the first Entry, so that the next call to getNextEntry() will return the first one in the block
 
Methods inherited from class noope.input.BlockReader
assertEmpty
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StringBlockReader

public StringBlockReader(java.lang.String s)
                  throws BlockReaderException
Method Detail

getHeader

public java.lang.String getHeader()
Description copied from class: BlockReader
Returns the header of this block. This is in some sense its "title".
Overrides:
getHeader in class BlockReader

getParameter

public java.lang.String getParameter()
Description copied from class: BlockReader
Returns the parameter of this block.
Overrides:
getParameter in class BlockReader

hasMoreEntries

public boolean hasMoreEntries()
Description copied from class: BlockReader
Returns TRUE if this block has more Entries after the one that was last returned
Overrides:
hasMoreEntries in class BlockReader

getNextEntry

public java.lang.String[] getNextEntry()
                                throws BlockReaderException
Description copied from class: BlockReader
Returns the next Entry, as a string array.
Overrides:
getNextEntry in class BlockReader

peekNextEntry

public java.lang.String[] peekNextEntry()
                                 throws BlockReaderException
Description copied from class: BlockReader
This method acts as getNextEntry() but does not advance position
Overrides:
peekNextEntry in class BlockReader

seekFirstEntry

public void seekFirstEntry()
                    throws BlockReaderException
Description copied from class: BlockReader
Moves the "entry pointer" back to the first Entry, so that the next call to getNextEntry() will return the first one in the block
Overrides:
seekFirstEntry in class BlockReader

getEntryLocation

public BlockReaderLocation getEntryLocation()
Description copied from class: BlockReader
Returns a BlockReaderLocation object describing the current Entry location. A BlockReaderLocation does not make sense to anyone, except this BlockReader and its parents.
Overrides:
getEntryLocation in class BlockReader

hasMoreBlocks

public boolean hasMoreBlocks()
Description copied from class: BlockReader
Returns TRUE if this block has more Blocks after the one that was last returned
Overrides:
hasMoreBlocks in class BlockReader

getNextBlock

public BlockReader getNextBlock()
                         throws BlockReaderException
Description copied from class: BlockReader
Returns the next subblock, which is an instance of BlockReader. The first time called, it returns the first entry, and thereafter, returns successively later entries. If no more exist, it will throw an exception.
Overrides:
getNextBlock in class BlockReader

peekNextBlock

public BlockReader peekNextBlock()
                          throws BlockReaderException
Description copied from class: BlockReader
This method acts as getNextBlock() but does not advance position
Overrides:
peekNextBlock in class BlockReader

seekFirstBlock

public void seekFirstBlock()
                    throws BlockReaderException
Description copied from class: BlockReader
Resets the subblock position to the beginning, so that the next call to getNextBlock() will return the first subblock (unless there are no subblocks, in which case an exception is thrown, of course.
Overrides:
seekFirstBlock in class BlockReader

getBlockLocation

public BlockReaderLocation getBlockLocation()
Description copied from class: BlockReader
Similar to getEntryLocation
Overrides:
getBlockLocation in class BlockReader

getContext

public BlockReaderContext getContext(BlockReaderLocation loc)
Description copied from class: BlockReader
Converts a Location into a fully-qualified Context object. This means that error messages, reports, etc... can be generated.
Overrides:
getContext in class BlockReader