01: package spoon.support.builder.support;
02:
03: import java.io.ByteArrayInputStream;
04: import java.io.InputStream;
05:
06: import spoon.support.builder.CtFile;
07: import spoon.support.builder.CtFolder;
08:
09: public class CtVirtualFile implements CtFile {
10:
11: InputStream contents;
12:
13: String name = "";
14:
15: public CtVirtualFile(String _contents) {
16: byte[] contentsBA = _contents.getBytes();
17: contents = new ByteArrayInputStream(contentsBA);
18:
19: }
20:
21: public CtVirtualFile(String _contents, String _name) {
22: this (_contents);
23: name = _name;
24: }
25:
26: public InputStream getContent() {
27: return contents;
28: }
29:
30: public boolean isJava() {
31: return true;
32: }
33:
34: public String getName() {
35: return name;
36: }
37:
38: public CtFolder getParent() {
39: return new CtVirtualFolder();
40: }
41:
42: public String getPath() {
43: return "";
44: }
45:
46: public boolean isFile() {
47: return true;
48: }
49:
50: }
|