parse

Parses the Java code contained in the InputStream and returns a CompilationUnit that represents it.

Return

CompilationUnit representing the Java source code

Parameters

in

InputStream containing Java source code. It will be closed after parsing.

Throws

if the source code has parser errors


Parses the Java code contained in a File and returns a CompilationUnit that represents it.

Return

CompilationUnit representing the Java source code

Parameters

file

File containing Java source code. It will be closed after parsing.

Throws

if the source code has parser errors

the file was not found


Parses the Java code contained in a file and returns a CompilationUnit that represents it.

Return

CompilationUnit representing the Java source code

Parameters

path

path to a file containing Java source code

Throws

if the source code has parser errors

the path could not be accessed


open fun parse(@NotNull reader: Reader): CompilationUnit(source)

Parses Java code from a Reader and returns a CompilationUnit that represents it.

Return

CompilationUnit representing the Java source code

Parameters

reader

the reader containing Java source code. It will be closed after parsing.

Throws

if the source code has parser errors


Parses the Java code contained in code and returns a CompilationUnit that represents it.

Return

CompilationUnit representing the Java source code

Parameters

code

Java source code

Throws

if the source code has parser errors


Deprecated

set the encoding in the ParserConfiguration

Parses the Java code contained in the InputStream and returns a CompilationUnit that represents it.

Return

CompilationUnit representing the Java source code

Parameters

in

InputStream containing Java source code. It will be closed after parsing.

encoding

encoding of the source code

Throws

if the source code has parser errors


open fun parse(@NotNull file: File, @NotNull encoding: Charset): CompilationUnit(source)

Deprecated

set the encoding in the ParserConfiguration

Parses the Java code contained in a File and returns a CompilationUnit that represents it.

Return

CompilationUnit representing the Java source code

Parameters

file

File containing Java source code. It will be closed after parsing.

encoding

encoding of the source code

Throws

if the source code has parser errors

the file was not found


open fun parse(@NotNull path: Path, @NotNull encoding: Charset): CompilationUnit(source)

Deprecated

set the encoding in the ParserConfiguration

Parses the Java code contained in a file and returns a CompilationUnit that represents it.

Return

CompilationUnit representing the Java source code

Parameters

path

path to a file containing Java source code

encoding

encoding of the source code

Throws

the path could not be accessed

if the source code has parser errors