X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.graph.compiler%2Fsrc%2Forg%2Fsimantics%2Fgraph%2Fcompiler%2Finternal%2Fltk%2FFileSource.java;fp=bundles%2Forg.simantics.graph.compiler%2Fsrc%2Forg%2Fsimantics%2Fgraph%2Fcompiler%2Finternal%2Fltk%2FFileSource.java;h=14640fae3b059e22ad08313550f55539cce7ac6d;hp=0000000000000000000000000000000000000000;hb=6b5821ad728bf2f127091cb36d57b87749a6532f;hpb=c2ab38c94029486a379c79a7b38604f1c03afa44 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 index 000000000..14640fae3 --- /dev/null +++ b/bundles/org.simantics.graph.compiler/src/org/simantics/graph/compiler/internal/ltk/FileSource.java @@ -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; + } +}