|
janino.net | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.codehaus.janino.Scanner
public class Scanner
Splits up a character stream into tokens and returns them as
String objects.
The optionalFileName parameter passed to many
constructors should point
| Nested Class Summary | |
|---|---|
class |
Scanner.Token
Representation of a Java™ token. |
| Constructor Summary | |
|---|---|
Scanner(File file)
Deprecated. // SUPPRESS CHECKSTYLE MissingDeprecated |
|
Scanner(File file,
String optionalEncoding)
Deprecated. // SUPPRESS CHECKSTYLE MissingDeprecated |
|
Scanner(String fileName)
Deprecated. // SUPPRESS CHECKSTYLE MissingDeprecated |
|
Scanner(String optionalFileName,
InputStream is)
Set up a scanner that reads tokens from the given InputStream in the platform default encoding. |
|
Scanner(String optionalFileName,
InputStream is,
String optionalEncoding)
Set up a scanner that reads tokens from the given InputStream with the given optionalEncoding
(null means platform default encoding). |
|
Scanner(String optionalFileName,
Reader in)
Set up a scanner that reads tokens from the given Reader. |
|
Scanner(String optionalFileName,
Reader in,
short initialLineNumber,
short initialColumnNumber)
Creates a Scanner that counts lines and columns from non-default initial values. |
|
Scanner(String fileName,
String encoding)
Deprecated. // SUPPRESS CHECKSTYLE MissingDeprecated |
|
| Method Summary | |
|---|---|
void |
close()
Deprecated. This method is deprecated, because the concept described above is confusing. An application should close the underlying InputStream or Reader itself. |
String |
doc()
Get the text of the doc comment (a.k.a. |
boolean |
getExpectGreater()
|
String |
getFileName()
|
Location |
location()
|
Scanner.Token |
produce()
Preduces and returns the next token. |
boolean |
setExpectGreater(boolean value)
Sets or resets the 'expect greater' mode. |
void |
setWarningHandler(WarningHandler optionalWarningHandler)
By default, warnings are discarded, but an application my install a WarningHandler. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
@Deprecated
public Scanner(String fileName)
throws CompileException,
IOException
This method is deprecated because it leaves the input file open.
CompileException
IOException
@Deprecated
public Scanner(String fileName,
String encoding)
throws CompileException,
IOException
This method is deprecated because it leaves the input file open.
CompileException
IOException
@Deprecated
public Scanner(File file)
throws CompileException,
IOException
This method is deprecated because it leaves the input file open.
CompileException
IOException
@Deprecated
public Scanner(File file,
String optionalEncoding)
throws CompileException,
IOException
This method is deprecated because it leaves the input file open.
CompileException
IOException
public Scanner(String optionalFileName,
InputStream is)
throws CompileException,
IOException
InputStream in the platform default encoding.
The fileName is solely used for reporting in thrown
exceptions.
CompileException
IOException
public Scanner(String optionalFileName,
InputStream is,
String optionalEncoding)
throws CompileException,
IOException
InputStream with the given optionalEncoding
(null means platform default encoding).
The optionalFileName is used for reporting errors during
compilation and for source level debugging, and should name an existing
file. If null is passed, and the system property
org.codehaus.janino.source_debugging.enable is set to "true", then
a temporary file in org.codehaus.janino.source_debugging.dir or the
system's default temp dir is created in order to make the source code
available to a debugger.
CompileException
IOException
public Scanner(String optionalFileName,
Reader in)
throws CompileException,
IOException
Reader.
The optionalFileName is used for reporting errors during
compilation and for source level debugging, and should name an existing
file. If null is passed, and the system property
org.codehaus.janino.source_debugging.enable is set to "true", then
a temporary file in org.codehaus.janino.source_debugging.dir or the
system's default temp dir is created in order to make the source code
available to a debugger.
CompileException
IOException
public Scanner(String optionalFileName,
Reader in,
short initialLineNumber,
short initialColumnNumber)
throws CompileException,
IOException
Scanner that counts lines and columns from non-default initial values.
CompileException
IOException| Method Detail |
|---|
public String getFileName()
@Deprecated
public void close()
throws IOException
InputStream or Reader itself.
InputStream, Reader) associated with this object. The results
of future calls to produce() are undefined.
IOExceptionpublic String doc()
null if the next token is not preceeded by a doc commentpublic Location location()
Location of the next character
public Scanner.Token produce()
throws CompileException,
IOException
null
product, but by the special Scanner.Token.EOF token.
CompileException
IOExceptionpublic boolean getExpectGreater()
public boolean setExpectGreater(boolean value)
public void setWarningHandler(WarningHandler optionalWarningHandler)
WarningHandler.
Notice that there is no Scanner.setErrorHandler() method, but scan errors
always throw a CompileException. The reason being is that there is no reasonable
way to recover from scan errors and continue scanning, so there is no need to install
a custom scan error handler.
optionalWarningHandler - null to indicate that no warnings be issued
|
janino.net | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||