01: /*
02: * Spoon - http://spoon.gforge.inria.fr/
03: * Copyright (C) 2006 INRIA Futurs <renaud.pawlak@inria.fr>
04: *
05: * This software is governed by the CeCILL-C License under French law and
06: * abiding by the rules of distribution of free software. You can use, modify
07: * and/or redistribute the software under the terms of the CeCILL-C license as
08: * circulated by CEA, CNRS and INRIA at http://www.cecill.info.
09: *
10: * This program is distributed in the hope that it will be useful, but WITHOUT
11: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12: * FITNESS FOR A PARTICULAR PURPOSE. See the CeCILL-C License for more details.
13: *
14: * The fact that you are presently reading this means that you have had
15: * knowledge of the CeCILL-C license and that you accept its terms.
16: */
17:
18: package spoon.support.builder.support;
19:
20: import java.io.ByteArrayInputStream;
21: import java.io.InputStream;
22:
23: import spoon.support.builder.CtFile;
24: import spoon.support.builder.CtFolder;
25:
26: public class CtFileZip implements CtFile {
27:
28: byte[] buffer;
29:
30: String name;
31:
32: CtFolderZip parent;
33:
34: public CtFileZip(CtFolderZip parent, String name, byte[] buffer) {
35: super ();
36: this .buffer = buffer;
37: this .name = name;
38: this .parent = parent;
39: }
40:
41: public InputStream getContent() {
42: return new ByteArrayInputStream(buffer);
43: }
44:
45: public String getName() {
46: return name;
47: }
48:
49: public CtFolder getParent() {
50: return parent;
51: }
52:
53: public boolean isFile() {
54: return true;
55: }
56:
57: public boolean isJava() {
58: return getName().endsWith(".java");
59: }
60:
61: public String getPath() {
62: return toString();
63: }
64:
65: @Override
66: public String toString() {
67: return getName();
68: }
69:
70: }
|