KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > core > execution > TaskIO


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.core.execution;
21
22 import java.io.Reader JavaDoc;
23 import java.io.Writer JavaDoc;
24
25 import org.openide.windows.InputOutput;
26
27 /** simply contains all ins n' outs for running task
28 * There is one instance for every running task.
29 *
30 * @author Ales Novak
31 * @version 0.11 April 24, 1998
32 */

33 class TaskIO {
34
35     /** No name */
36     static final String JavaDoc VOID = "noname"; // NOI18N
37

38     /** stdout for task */
39     Writer JavaDoc out;
40     /** stderr */
41     Writer JavaDoc err;
42     /** stdin */
43     Reader JavaDoc in;
44
45     /** 'theme' for this task */
46     InputOutput inout;
47
48     /** name for the TaskIO */
49     private String JavaDoc name;
50
51     /** Should not be this TaskIO processed by IOTable? */
52     boolean foreign;
53
54     TaskIO () {
55         name = VOID;
56     }
57
58     /**
59     * @param inout is an InputOutput
60     * @param name is a name
61     */

62     TaskIO (InputOutput inout) {
63         this(inout, VOID);
64     }
65
66     /**
67     * @param inout is an InputOutput
68     * @param name is a name
69     */

70     TaskIO (InputOutput inout, String JavaDoc name) {
71         this.inout = inout;
72         this.name = name;
73     }
74
75     /**
76     * @param inout is an InputOutput
77     * @param name is a name
78     * @param foreign if true then IOTable never cares about this TaskIO
79     */

80     TaskIO (InputOutput inout, String JavaDoc name, boolean foreign) {
81         this.inout = inout;
82         this.name = name;
83         this.foreign = foreign;
84     }
85
86     /** inits out */
87     void initOut () {
88         if (out == null) {
89             out = inout.getOut();
90         }
91     }
92
93     /** inits err */
94     void initErr() {
95         if (err == null) {
96             err = inout.getErr();
97         }
98     }
99
100     /** inits in */
101     void initIn() {
102         if (in == null) {
103             in = inout.getIn();
104         }
105     }
106
107     /**
108     * @return name
109     */

110     String JavaDoc getName() {
111         return name;
112     }
113
114     /**
115     * @return InputOutput for this TaskIO
116     */

117     InputOutput getInout() {
118         return inout;
119     }
120 }
121
Popular Tags