Package de.firemage.autograder.core.file
Interface CompilationUnit
- All Superinterfaces:
Serializable
- All Known Implementing Classes:
PhysicalFileObject
Represents a compilation unit, which is a source file that can be compiled.
-
Method Summary
Modifier and TypeMethodDescriptioncharset()Returns the original charset of the compilation unit.path()Returns the path including the name of the compilation unit.default StringReturns the content of the compilation unit as a string-Converts this compilation unit to aJavaFileObject.
-
Method Details
-
toJavaFileObject
JavaFileObject toJavaFileObject()Converts this compilation unit to aJavaFileObject.- Returns:
- the
JavaFileObject
-
charset
Charset charset()Returns the original charset of the compilation unit.- Returns:
- the charset of the source file
-
path
SourcePath path()Returns the path including the name of the compilation unit.The path must not include the root. For example if the root is
src/main/javaand the compilation unit issrc/main/java/de/firemage/autograder/core/file/CompilationUnit.java, the path must bede/firemage/autograder/core/file/CompilationUnit.java.- Returns:
- the path of the compilation unit
- See Also:
-
SourcePath.resolve(SourcePath)
-
readString
Returns the content of the compilation unit as a string-- Returns:
- the content of the compilation unit, never null
- Throws:
IOException- if the content could not be read
-