Source Code Cross Referenced for DefaultEnvironment.java in  » Parser » JTopas » de » susebox » java » 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 » Parser » JTopas » de.susebox.java.lang 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * DefaultEnvironment.java: Environment implementation based on the Java System class.
003:         *
004:         * Copyright (C) 2002 Heiko Blau
005:         *
006:         * This file belongs to the Susebox Java Core Library (Susebox JCL).
007:         * The Susebox JCL is free software; you can redistribute it and/or modify it
008:         * under the terms of the GNU Lesser General Public License as published by the
009:         * Free Software Foundation; either version 2.1 of the License, or (at your
010:         * option) any later version.
011:         *
012:         * This software is distributed in the hope that it will be useful, but WITHOUT
013:         * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
014:         * FITNESS FOR A PARTICULAR PURPOSE.
015:         * See the GNU Lesser General Public License for more details.
016:         *
017:         * You should have received a copy of the GNU Lesser General Public License along
018:         * with the Susebox JCL. If not, write to the
019:         *
020:         *   Free Software Foundation, Inc.
021:         *   59 Temple Place, Suite 330,
022:         *   Boston, MA 02111-1307
023:         *   USA
024:         *
025:         * or check the Internet: http://www.fsf.org
026:         *
027:         * Contact:
028:         *   email: heiko@susebox.de
029:         */
030:
031:        package de.susebox.java.lang;
032:
033:        //-----------------------------------------------------------------------------
034:        // Imports
035:        //
036:        import java.io.InputStream;
037:        import java.io.PrintStream;
038:
039:        //-----------------------------------------------------------------------------
040:        // Class DefaultEnvironment
041:        //
042:
043:        /**<p>
044:         * The <code>DefaultEnvironment</code> implements the {@link Environment} interface 
045:         * using the JDK class {@link java.lang.System}. Instances of this class are
046:         * returned by the singleton {@link EnvironmentProvider} ({@link EnvironmentProvider#getEnvironment})
047:         * if there is no other <code>Environment</code> available for the caller.
048:         *</p>
049:         *
050:         * @see     Environment
051:         * @see     EnvironmentProvider
052:         * @author  Heiko Blau
053:         */
054:        public class DefaultEnvironment implements  Environment {
055:
056:            //---------------------------------------------------------------------------
057:            // methods of the Environment interface
058:            //
059:
060:            /**
061:             * This method returns {@link java.lang.System#in}, the standard input channel.
062:             *
063:             * @return  the {@link java.io.InputStream} that serves as standard input
064:             * @see     java.lang.System#in
065:             */
066:            public InputStream in() {
067:                return System.in;
068:            }
069:
070:            /**
071:             * This method returns {@link java.lang.System#out}, the standard output channel.
072:             *
073:             * @return  the {@link java.io.PrintStream} that serves as standard output
074:             * @see     java.lang.System#out
075:             */
076:            public PrintStream out() {
077:                return System.out;
078:            }
079:
080:            /**
081:             * This method returns {@link java.lang.System#err}, the standard error channel.
082:             *
083:             * @return  the {@link java.io.PrintStream} that serves as standard error output
084:             * @see     java.lang.System#err
085:             */
086:            public PrintStream err() {
087:                return System.err;
088:            }
089:
090:            /**
091:             * This method stores the exit code of an application. It can be called more
092:             * than once.
093:             *
094:             * @param status  the exit code of an application
095:             * @see   java.lang.System#exit
096:             */
097:            public void setExitStatus(int status) {
098:                _exitStatus = status;
099:            }
100:
101:            /**
102:             * Retrieving the currently set exit code.
103:             *
104:             * @return the currently set exit code of an application
105:             */
106:            public int getExitStatus() {
107:                return _exitStatus;
108:            }
109:
110:            /**
111:             * This method exits the instance of its <code>Environment</code> implementation.
112:             * After calling <code>exit</code> the <code>Environment</code> instance is
113:             * generally not any longer usable. In particular, an implementation can choose
114:             * to call {@link java.lang.System#exit}.
115:             *
116:             * @see   #setExitStatus
117:             * @see   java.lang.System#exit
118:             */
119:            public void exit() throws UnsupportedOperationException {
120:                System.exit(getExitStatus());
121:            }
122:
123:            //---------------------------------------------------------------------------
124:            // members
125:            //
126:            private int _exitStatus = 0;
127:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.