KickJava   Java API By Example, From Geeks To Geeks.

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


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.IOException JavaDoc;
23 import java.io.InputStream JavaDoc;
24
25 /** demutiplexes in-requests to task specific window
26 *
27 * @author Ales Novak
28 * @version 0.10 Dec 04, 1997
29 */

30 final class SysIn extends InputStream JavaDoc {
31
32     public SysIn() {
33     }
34
35     /** reads one char */
36     public int read() throws IOException JavaDoc {
37         return ExecutionEngine.getTaskIOs().getIn().read ();
38     }
39
40     /** reads an array of bytes */
41     public int read(byte[] b, int off, final int len) throws IOException JavaDoc {
42         char[] b2 = new char[len];
43         int ret = ExecutionEngine.getTaskIOs().getIn().read(b2, 0, len);
44         for (int i = 0; i < len; i++) {
45             b[off + i] = (byte) b2[i];
46         }
47         return ret;
48     }
49
50     /** closes the stream */
51     public void close() throws IOException JavaDoc {
52         ExecutionEngine.getTaskIOs().getIn().close();
53     }
54
55     /** marks position at position <code>x</code> */
56     public void mark(int x) {
57         try {
58             ExecutionEngine.getTaskIOs().getIn().mark(x);
59         } catch (IOException JavaDoc e) {
60             // [TODO]
61
}
62     }
63
64     /** resets the stream */
65     public void reset() throws IOException JavaDoc {
66         ExecutionEngine.getTaskIOs().getIn().reset();
67     }
68
69     /**
70     * @return true iff mark is supported false otherwise
71     */

72     public boolean markSupported() {
73         return ExecutionEngine.getTaskIOs().getIn().markSupported();
74     }
75
76     /** skips <code>l</code> bytes
77     * @return number of skipped bytes
78     */

79     public long skip(long l) throws IOException JavaDoc {
80         return ExecutionEngine.getTaskIOs().getIn().skip(l);
81     }
82 }
83
Popular Tags