org.glassfish.admin.rest.readers
Class InputReader

java.lang.Object
  extended by org.glassfish.admin.rest.readers.InputReader
Direct Known Subclasses:
XmlInputReader

public class InputReader
extends java.lang.Object

Author:
rajeshwar patil

Constructor Summary
InputReader(java.io.Reader reader)
          Construct a InputReader from a string.
InputReader(java.lang.String s)
          Construct a InputReader from a string.
 
Method Summary
 void back()
          Back up one character.
 InputException error(java.lang.String message)
          Resturns InputException to signal a syntax error.
 boolean more()
          Determine if the source string still contains characters that next() can consume.
 char next()
          Get the next character in the source string.
 java.lang.String next(int n)
          Get the next n characters.
 char nextNonSpace()
          Get the next char in the string, skipping whitespace.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InputReader

public InputReader(java.io.Reader reader)
Construct a InputReader from a string.

Parameters:
reader - A reader.

InputReader

public InputReader(java.lang.String s)
Construct a InputReader from a string.

Parameters:
s - A source string.
Method Detail

back

public void back()
          throws InputException
Back up one character.

Throws:
InputException

next

public char next()
          throws InputException
Get the next character in the source string.

Returns:
The next character, or 0 if past the end of the source string.
Throws:
InputException

error

public InputException error(java.lang.String message)
Resturns InputException to signal a syntax error.

Parameters:
message - The error message.
Returns:
A InputException object, suitable for throwing

nextNonSpace

public char nextNonSpace()
                  throws InputException
Get the next char in the string, skipping whitespace.

Returns:
A character, or 0 if there are no more characters.
Throws:
InputException

next

public java.lang.String next(int n)
                      throws InputException
Get the next n characters.

Parameters:
n - The number of characters to take.
Returns:
A string of n characters.
Throws:
InputException - Substring bounds error if there are not n characters remaining in the source string.

more

public boolean more()
             throws InputException
Determine if the source string still contains characters that next() can consume.

Returns:
true if not yet at the end of the source.
Throws:
InputException


Copyright © 2012 GlassFish Community. All Rights Reserved.