| java.lang.Object com.quadcap.util.text.Scanner
Scanner | public class Scanner (Code) | | The class implements a series of low-level stream scanning operations,
using OctetMaps to implement 'while' and 'until'.
author: Stan Bailes |
Method Summary | |
public static int | copyUntil(InputStream is, OutputStream os, OctetMap map) Copy bytes from an input stream to an output stream until a byte
in the specified set is found. | public static int | copyUntil(InputStream is, OutputStream os, int dc) | public static int | copyUntil(BufferedInputStream is, OutputStream os, String s) Copy bytes from in to out until the
specified string is is.read from in | public static int | copyWhile(InputStream is, OutputStream os, OctetMap map) Copy bytes from an input stream to an output stream until a byte
not in the specified set is found. | public String | getLog() | final public void | matchChar(int expected) Read the next character, and verify that it is equal to the expected
value. | final public void | matchString(OctetMap map, String expected) Read the next string using the specified map, and verify that it
IS equal to the expected value. | final public void | matchStringIgnoreCase(OctetMap map, String expected) Read the next string using the specified map, and verify that it
IS equal to the expected value, if all characters in both
strings are converted to monocase. | final public String | parseUntil(OctetMap map) Return the next portion of the stream which consists of characters
NOT IN the specified set. | final public String | parseWhile(OctetMap map) Return the next portion of the stream which consists of characters
IN the specified set. | final public int | peek() Peek ahead one character in the stream by reading, then pushing back
the character. | final int | read() | public void | reset(InputStream is) | final public void | skipUntil(OctetMap map) Read and discard characters until a character is found which
is in the map. | final public void | skipWhile(OctetMap map) Read and discard characters until a character is found which
is not in the map. | public static int | skipWhile(InputStream is, int dc) Read and discard characters until a character is found which
is not equal to the specified character. | final void | unread(int c) |
Scanner | public Scanner(InputStream is)(Code) | | Construct a new scanner, attached to the specified input stream.
Parameters: is - the stream to scan. |
copyUntil | public static int copyUntil(InputStream is, OutputStream os, OctetMap map) throws IOException(Code) | | Copy bytes from an input stream to an output stream until a byte
in the specified set is found. That byte is returned, or -1
the end of file is reached.
Parameters: is - the input stream from which bytes are is.read Parameters: os - the output stream to which bytes are written Parameters: map - the set of valid delimiter bytes the first matching byte exception: IOException - may be thrown |
copyUntil | public static int copyUntil(BufferedInputStream is, OutputStream os, String s) throws IOException(Code) | | Copy bytes from in to out until the
specified string is is.read from inout
Parameters: is - the input stream from which bytes are is.read Parameters: os - the output stream to which bytes are written Parameters: s - the delimiter string < 0 if end of file is reached before the string is found,>= 0 otherwise exception: IOException - may be thrown |
copyWhile | public static int copyWhile(InputStream is, OutputStream os, OctetMap map) throws IOException(Code) | | Copy bytes from an input stream to an output stream until a byte
not in the specified set is found. That byte is returned, or -1
the end of file is reached.
Parameters: is - the input stream from which bytes are is.read Parameters: os - the output stream to which bytes are written Parameters: map - the set of valid byte to copy the first non matching byte exception: IOException - may be thrown |
matchChar | final public void matchChar(int expected) throws IOException(Code) | | Read the next character, and verify that it is equal to the expected
value.
Parameters: expected - the expected character exception: IOException - if the character read from the stream is notequal to the specified character. |
matchString | final public void matchString(OctetMap map, String expected) throws IOException(Code) | | Read the next string using the specified map, and verify that it
IS equal to the expected value.
Parameters: expected - the expected string exception: IOException - if the character read from the stream is notequal to the specified character. |
matchStringIgnoreCase | final public void matchStringIgnoreCase(OctetMap map, String expected) throws IOException(Code) | | Read the next string using the specified map, and verify that it
IS equal to the expected value, if all characters in both
strings are converted to monocase.
Parameters: expected - the expected string exception: IOException - if the character read from the stream is notequal to the specified character. |
parseUntil | final public String parseUntil(OctetMap map) throws IOException(Code) | | Return the next portion of the stream which consists of characters
NOT IN the specified set.
Parameters: map - the set of characters to parse. exception: IOException - if an I/O exception is thrown |
parseWhile | final public String parseWhile(OctetMap map) throws IOException(Code) | | Return the next portion of the stream which consists of characters
IN the specified set.
Parameters: map - the set of characters to parse. exception: IOException - if an I/O exception is thrown |
peek | final public int peek() throws IOException(Code) | | Peek ahead one character in the stream by reading, then pushing back
the character.
the next character from the stream. exception: IOException - if an exception is thrown when the characteris read. |
skipUntil | final public void skipUntil(OctetMap map) throws IOException(Code) | | Read and discard characters until a character is found which
is in the map. Then push back the terminating character.
Parameters: map - the set of characters which skip. exception: IOException - if an I/O exception is thrown |
skipWhile | final public void skipWhile(OctetMap map) throws IOException(Code) | | Read and discard characters until a character is found which
is not in the map. Then push back the terminating character.
Parameters: map - the set of characters to skip. exception: IOException - if an I/O exception is thrown |
skipWhile | public static int skipWhile(InputStream is, int dc) throws IOException(Code) | | Read and discard characters until a character is found which
is not equal to the specified character. Return the
terminating character.
Parameters: dc - the character to discard exception: IOException - if an I/O exception is thrown |
unread | final void unread(int c)(Code) | | |
|
|