01: /*
02: * The contents of this file are subject to the terms
03: * of the Common Development and Distribution License
04: * (the "License"). You may not use this file except
05: * in compliance with the License.
06: *
07: * You can obtain a copy of the license at
08: * https://jwsdp.dev.java.net/CDDLv1.0.html
09: * See the License for the specific language governing
10: * permissions and limitations under the License.
11: *
12: * When distributing Covered Code, include this CDDL
13: * HEADER in each file and include the License file at
14: * https://jwsdp.dev.java.net/CDDLv1.0.html If applicable,
15: * add the following below this CDDL HEADER, with the
16: * fields enclosed by brackets "[]" replaced with your
17: * own identifying information: Portions Copyright [yyyy]
18: * [name of copyright owner]
19: */
20:
21: package com.sun.codemodel;
22:
23: import java.io.IOException;
24: import java.io.OutputStream;
25:
26: /**
27: * Represents a resource file in the application-specific file format.
28: */
29: public abstract class JResourceFile {
30:
31: private final String name;
32:
33: protected JResourceFile(String name) {
34: this .name = name;
35: }
36:
37: /**
38: * Gets the name of this property file
39: */
40: public String name() {
41: return name;
42: }
43:
44: /**
45: * Returns true if this file should be generated into the directory
46: * that the resource files go into.
47: *
48: * <p>
49: * Returns false if this file should be generated into the directory
50: * where other source files go.
51: */
52: protected boolean isResource() {
53: return true;
54: }
55:
56: /**
57: * called by JPackage to produce the file image.
58: */
59: protected abstract void build(OutputStream os) throws IOException;
60: }
|