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