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 void
back()
Back up one character.InputException
error(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.String
next(int n)
Get the next n characters.char
nextNonSpace()
Get the next char in the string, skipping whitespace.
-
-
-
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(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 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
-
-