Package org.glassfish.admin.rest.readers
Class InputReader
- java.lang.Object
-
- org.glassfish.admin.rest.readers.InputReader
-
- Direct Known Subclasses:
XmlInputReader
public class InputReader extends Object
- Author:
- rajeshwar patil
-
-
Constructor Summary
Constructors Constructor Description InputReader(Reader reader)Construct a InputReader from a string.InputReader(String s)Construct a InputReader from a string.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidback()Back up one character.InputExceptionerror(String message)Resturns InputException to signal a syntax error.booleanmore()Determine if the source string still contains characters that next() can consume.charnext()Get the next character in the source string.Stringnext(int n)Get the next n characters.charnextNonSpace()Get the next char in the string, skipping whitespace.
-
-
-
Method Detail
-
back
public void back() throws InputExceptionBack up one character.- Throws:
InputException
-
next
public char next() throws InputExceptionGet 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(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 InputExceptionGet the next char in the string, skipping whitespace.- Returns:
- A character, or 0 if there are no more characters.
- Throws:
InputException
-
next
public 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 InputExceptionDetermine if the source string still contains characters that next() can consume.- Returns:
- true if not yet at the end of the source.
- Throws:
InputException
-
-