sdsu.io
Class CommentParser

java.lang.Object
  |
  +--sdsu.io.CommentParser

public class CommentParser
extends java.lang.Object

Parses two types of comments: normal and data. A normal comment starts with a comment character on a new line. (Actually a comment in indicated when the first non-whitespace character on a new line is the comment char.) A data comment is a comment with the special comment character occuring immediatley after the comment character in a comment and the text in the comment is formated in name-value pairs. These pairs can be used to create a LabeledData object.

Version:
1.0 12 June 1998
Author:
Roger Whitney (whitney@cs.sdsu.edu)

Constructor Summary
CommentParser(java.io.PushbackReader input, char commentChar, char specialCommentChar)
           
CommentParser(java.io.PushbackReader input, char commentChar, char specialCommentChar, java.lang.String whiteSpace)
           
 
Method Summary
 java.lang.String readAll()
          Returns rest of the input in a string
 java.lang.String readComment()
          Returns comment from the input If input does not start with a comment return a string of length zero
 LabeledData readDataComment()
          Returns special comment from the input If input does not start with a special comment return a string of length zero
 void removeWhiteSpace()
          Insures that the input stream starts with non-whitespace char
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CommentParser

public CommentParser(java.io.PushbackReader input,
                     char commentChar,
                     char specialCommentChar)

CommentParser

public CommentParser(java.io.PushbackReader input,
                     char commentChar,
                     char specialCommentChar,
                     java.lang.String whiteSpace)
Method Detail

removeWhiteSpace

public void removeWhiteSpace()
                      throws java.io.IOException
Insures that the input stream starts with non-whitespace char

readAll

public java.lang.String readAll()
                         throws java.io.IOException
Returns rest of the input in a string

readComment

public java.lang.String readComment()
                             throws java.io.IOException
Returns comment from the input If input does not start with a comment return a string of length zero

readDataComment

public LabeledData readDataComment()
                            throws java.io.IOException
Returns special comment from the input If input does not start with a special comment return a string of length zero