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%2FLocalResourceSource.java;fp=bundles%2Forg.simantics.graph.compiler%2Fsrc%2Forg%2Fsimantics%2Fgraph%2Fcompiler%2Finternal%2Fltk%2FLocalResourceSource.java;h=34cda236491acf0d31306362b5cf42878487cdc3;hp=0000000000000000000000000000000000000000;hb=6b5821ad728bf2f127091cb36d57b87749a6532f;hpb=c2ab38c94029486a379c79a7b38604f1c03afa44 diff --git a/bundles/org.simantics.graph.compiler/src/org/simantics/graph/compiler/internal/ltk/LocalResourceSource.java b/bundles/org.simantics.graph.compiler/src/org/simantics/graph/compiler/internal/ltk/LocalResourceSource.java new file mode 100644 index 000000000..34cda2364 --- /dev/null +++ b/bundles/org.simantics.graph.compiler/src/org/simantics/graph/compiler/internal/ltk/LocalResourceSource.java @@ -0,0 +1,39 @@ +package org.simantics.graph.compiler.internal.ltk; + +import java.io.IOException; +import java.io.InputStream; + +public class LocalResourceSource implements ISource { + Class clazz; + String resource; + + public LocalResourceSource(Class clazz, String resource) { + this.clazz = clazz; + this.resource = resource; + } + + @Override + public InputStream open() throws IOException { + return clazz.getResourceAsStream(resource); + } + + @Override + public String getName() { + return resource; + } + + @Override + public int length() throws IOException { + return -1; + } + + @Override + public int startPos() { + return 0; + } + + @Override + public int startLine() { + return 0; + } +}