]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.graph.compiler/src/org/simantics/graph/compiler/internal/ltk/FileSource.java
Removed org.simantics.ltk[.antlr] bundles, exact import for antlr
[simantics/platform.git] / bundles / org.simantics.graph.compiler / src / org / simantics / graph / compiler / internal / ltk / FileSource.java
diff --git a/bundles/org.simantics.graph.compiler/src/org/simantics/graph/compiler/internal/ltk/FileSource.java b/bundles/org.simantics.graph.compiler/src/org/simantics/graph/compiler/internal/ltk/FileSource.java
new file mode 100644 (file)
index 0000000..14640fa
--- /dev/null
@@ -0,0 +1,43 @@
+package org.simantics.graph.compiler.internal.ltk;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+
+public class FileSource implements ISource {
+       File file;
+       
+       public FileSource(File file) {
+               this.file = file;
+       }
+
+       public FileSource(String fileName) {
+               this.file = new File(fileName);
+       }
+
+       @Override
+       public InputStream open() throws IOException {
+               return new FileInputStream(file);
+       }
+       
+       @Override
+       public String getName() {
+               return file.getName();
+       }
+
+       @Override
+       public int length() throws IOException {
+               return (int)file.length();
+       }
+       
+       @Override
+       public int startPos() {
+               return 0;
+       }
+       
+       @Override
+       public int startLine() {
+               return 0;
+       }
+}