]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.graph.compiler/src/org/simantics/graph/compiler/internal/ltk/LocalResourceSource.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 / LocalResourceSource.java
1 package org.simantics.graph.compiler.internal.ltk;
2
3 import java.io.IOException;
4 import java.io.InputStream;
5
6 public class LocalResourceSource implements ISource {
7     Class<?> clazz;
8     String resource;
9     
10     public LocalResourceSource(Class<?> clazz, String resource) {
11         this.clazz = clazz;
12         this.resource = resource;
13     }
14
15     @Override
16     public InputStream open() throws IOException {
17         return clazz.getResourceAsStream(resource);
18     }
19     
20     @Override
21     public String getName() {
22         return resource;
23     }
24
25     @Override
26     public int length() throws IOException {
27         return -1;
28     }
29     
30     @Override
31     public int startPos() {
32         return 0;
33     }
34     
35     @Override
36     public int startLine() {
37         return 0;
38     }
39 }