KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > lib > terminalemulator > TermStream


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 Terminal Emulator.
16  * The Initial Developer of the Original Software is Sun Microsystems, Inc..
17  * Portions created by Sun Microsystems, Inc. are Copyright (C) 2001.
18  * All Rights Reserved.
19  *
20  * Contributor(s): Ivan Soleimanipour.
21  */

22
23 /*
24  * "TermStream.java"
25  * TermStream.java 1.7 01/07/10
26  */

27
28 package org.netbeans.lib.terminalemulator;
29
30 /**
31  * TermStream is analogous to unix STREAMS.
32  * <br>
33  * It is a full duplex processing and data transfer path between a raw
34  * Term (The Data Terminal Equipment, DTE) and a client of the Term, usually
35  * a process (The Data Communication Equipment, DCE).
36  * <p>
37  * TermStream's can be chained together. This is performed using
38  * @see org.netbeans.lib.terminalemulator.Term#pushStream
39  * <p>
40  * Streams are usually used (in the context of terminals) to do echoing,
41  * line buffering, CR/NL translation and so on. See
42  * @see org.netbeans.lib.terminalemulator.LineDiscipline .
43  * They can also be used for logging and debugging.
44  */

45
46 public abstract class TermStream {
47     protected TermStream toDTE; // delegate putChar's to toDTE
48
protected TermStream toDCE; // delegate sendChar to from_keyboard
49

50     void setToDCE(TermStream toDCE) {
51     this.toDCE = toDCE;
52     }
53     void setToDTE(TermStream toDTE) {
54     this.toDTE = toDTE;
55     }
56
57     void setTerm(Term term) {
58     this.term = term;
59     }
60     protected Term getTerm() {
61     return term;
62     }
63     private Term term;
64
65
66     // From world (DCE) to terminal (DTE) screen
67
public abstract void flush();
68     public abstract void putChar(char c);
69     public abstract void putChars(char buf[], int offset, int count);
70
71     // From terminal *keyboard) (DTE) to world (DCE).
72
public abstract void sendChar(char c);
73     public abstract void sendChars(char c[], int offset, int count);
74 }
75
Popular Tags