Source Code Cross Referenced for TclTemplateChannel.java in  » Web-Server » Brazil » tcl » lang » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Web Server » Brazil » tcl.lang 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * TclTemplateChannel.java
003:         *
004:         * Brazil project web application Framework,
005:         * export version: 1.1 
006:         * Copyright (c) 1999-2000 Sun Microsystems, Inc.
007:         *
008:         * Sun Public License Notice
009:         *
010:         * The contents of this file are subject to the Sun Public License Version 
011:         * 1.0 (the "License"). You may not use this file except in compliance with 
012:         * the License. A copy of the License is included as the file "license.terms",
013:         * and also available at http://www.sun.com/
014:         * 
015:         * The Original Code is from:
016:         *    Brazil project web application Framework release 1.1.
017:         * The Initial Developer of the Original Code is: cstevens.
018:         * Portions created by cstevens are Copyright (C) Sun Microsystems, Inc.
019:         * All Rights Reserved.
020:         * 
021:         * Contributor(s): cstevens, suhler.
022:         *
023:         * Version:  1.4
024:         * Created by cstevens on 99/10/19
025:         * Last modified by suhler on 00/05/31 13:52:17
026:         */
027:
028:        package tcl.lang;
029:
030:        import sunlabs.brazil.template.RewriteContext;
031:
032:        import java.io.IOException;
033:
034:        /**
035:         * This class is used to replace the stdout for the Tcl Interp.
036:         * Everything written to stdout will instead be appended to the HTML
037:         * document.
038:         * <p>
039:         * This class is in the <code>tcl.lang</code> package because
040:         * <code>tcl.lang.Channel</code> and <code>tcl.lang.TclIO</code>
041:         * aren't public but we need to access those classes to define new
042:         * channels.
043:         *
044:         * @author	Colin Stevens (colin.stevens@sun.com)
045:         * @version	1.4, 00/05/31
046:         */
047:        public class TclTemplateChannel extends Channel {
048:            RewriteContext hr;
049:            Interp interp;
050:
051:            /**
052:             * Creates a replacement for stdout in this interp.
053:             * <p>
054:             * For each call to this procedure, there should eventually be a call
055:             * to <code>unregister</code> to restore the original stdout for this
056:             * interp and to release the resources associated with the given
057:             * <code>RewriteContext</code>.
058:             *
059:             * @param	interp
060:             *		The interp in which to replace stdout.
061:             *
062:             * @param	hr
063:             *		The RewriteContext to which all data written to stdout will
064:             *		be appended.
065:             */
066:            public TclTemplateChannel(Interp interp, RewriteContext hr) {
067:                this .interp = interp;
068:                this .hr = hr;
069:
070:                /*
071:                 * Unlike the standard C implementation of Tcl, you cannot actually
072:                 * close "stdout" and then open another channel which will become the
073:                 * new "stdout", because in JACL registering a channel does not
074:                 * automatically take over the next available closed standard stream.
075:                 * However, if you register a new channel called "file1", it does
076:                 * replace the standard "stdout".
077:                 */
078:
079:                setChanName("file1");
080:                TclIO.registerChannel(interp, this );
081:            }
082:
083:            /**
084:             * Removes this channel from the interp.  After calling this, the
085:             * original stdout for this interp will be restored.
086:             */
087:            public void unregister() {
088:                TclIO.registerChannel(interp, TclIO
089:                        .getStdChannel(StdChannel.STDOUT));
090:            }
091:
092:            public String read(Interp interp, int type, int numBytes)
093:                    throws IOException, TclException {
094:                throw new TclException(interp, "channel \"" + getChanName()
095:                        + "\" wasn't opened for reading");
096:            }
097:
098:            public void write(Interp interp, String s) throws IOException,
099:                    TclException {
100:                hr.append(s);
101:            }
102:
103:            public void close() throws IOException {
104:            }
105:
106:            public void flush(Interp interp) throws IOException, TclException {
107:            }
108:
109:            public void seek(long offset, int mode) throws IOException {
110:            }
111:
112:            public long tell() throws IOException {
113:                return ((long) -1);
114:            }
115:
116:            public boolean eof() {
117:                return true;
118:            }
119:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.