diff --git a/src/de/dhbwstuttgart/parser/JavaTXParser.java b/src/de/dhbwstuttgart/parser/JavaTXParser.java index 800a05374..b620f33e6 100644 --- a/src/de/dhbwstuttgart/parser/JavaTXParser.java +++ b/src/de/dhbwstuttgart/parser/JavaTXParser.java @@ -9,6 +9,7 @@ import org.antlr.v4.runtime.ANTLRInputStream; import org.antlr.v4.runtime.CommonTokenStream; import java.io.*; +import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.List; @@ -40,4 +41,8 @@ public class JavaTXParser { public SourceFile parse(File file) throws IOException, ClassNotFoundException { return this.parse(new FileInputStream(file)); } + + public SourceFile parse(String fileContent) throws IOException, ClassNotFoundException { + return this.parse(new ByteArrayInputStream(fileContent.getBytes(StandardCharsets.UTF_8))); + } }