Source Code Cross Referenced for InternetPrintWriter.java in  » Net » james-2.3.1 » org » apache » james » util » 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 » Net » james 2.3.1 » org.apache.james.util 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /****************************************************************
002:         * Licensed to the Apache Software Foundation (ASF) under one   *
003:         * or more contributor license agreements.  See the NOTICE file *
004:         * distributed with this work for additional information        *
005:         * regarding copyright ownership.  The ASF licenses this file   *
006:         * to you under the Apache License, Version 2.0 (the            *
007:         * "License"); you may not use this file except in compliance   *
008:         * with the License.  You may obtain a copy of the License at   *
009:         *                                                              *
010:         *   http://www.apache.org/licenses/LICENSE-2.0                 *
011:         *                                                              *
012:         * Unless required by applicable law or agreed to in writing,   *
013:         * software distributed under the License is distributed on an  *
014:         * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
015:         * KIND, either express or implied.  See the License for the    *
016:         * specific language governing permissions and limitations      *
017:         * under the License.                                           *
018:         ****************************************************************/package org.apache.james.util;
019:
020:        import java.io.OutputStream;
021:        import java.io.PrintWriter;
022:        import java.io.Writer;
023:
024:        /**
025:         * Writes to a wrapped Writer class, ensuring that all line separators are '\r\n', regardless
026:         * of platform.
027:         */
028:        public class InternetPrintWriter extends PrintWriter {
029:
030:            /**
031:             * The line separator to use.
032:             */
033:            private static String lineSeparator = "\r\n";
034:
035:            /**
036:             * Whether the Writer autoflushes on line feeds
037:             */
038:            private final boolean autoFlush;
039:
040:            /**
041:             * Constructor that takes a writer to wrap.
042:             *
043:             * @param out the wrapped Writer
044:             */
045:            public InternetPrintWriter(Writer out) {
046:                super (out);
047:                autoFlush = false;
048:            }
049:
050:            /**
051:             * Constructor that takes a writer to wrap.
052:             *
053:             * @param out the wrapped Writer
054:             * @param autoFlush whether to flush after each print call
055:             */
056:            public InternetPrintWriter(Writer out, boolean autoFlush) {
057:                super (out, autoFlush);
058:                this .autoFlush = autoFlush;
059:            }
060:
061:            /**
062:             * Constructor that takes a stream to wrap.
063:             *
064:             * @param out the wrapped OutputStream
065:             */
066:            public InternetPrintWriter(OutputStream out) {
067:                super (out);
068:                autoFlush = false;
069:            }
070:
071:            /**
072:             * Constructor that takes a stream to wrap.
073:             *
074:             * @param out the wrapped OutputStream
075:             * @param autoFlush whether to flush after each print call
076:             */
077:            public InternetPrintWriter(OutputStream out, boolean autoFlush) {
078:                super (out, autoFlush);
079:                this .autoFlush = autoFlush;
080:            }
081:
082:            /**
083:             * Print a line separator.
084:             */
085:            public void println() {
086:                synchronized (lock) {
087:                    write(lineSeparator);
088:                    if (autoFlush) {
089:                        flush();
090:                    }
091:                }
092:            }
093:
094:            /**
095:             * Print a boolean followed by a line separator.
096:             *
097:             * @param x the boolean to print
098:             */
099:            public void println(boolean x) {
100:                synchronized (lock) {
101:                    print(x);
102:                    println();
103:                }
104:            }
105:
106:            /**
107:             * Print a char followed by a line separator.
108:             *
109:             * @param x the char to print
110:             */
111:            public void println(char x) {
112:                synchronized (lock) {
113:                    print(x);
114:                    println();
115:                }
116:            }
117:
118:            /**
119:             * Print a int followed by a line separator.
120:             *
121:             * @param x the int to print
122:             */
123:            public void println(int x) {
124:                synchronized (lock) {
125:                    print(x);
126:                    println();
127:                }
128:            }
129:
130:            /**
131:             * Print a long followed by a line separator.
132:             *
133:             * @param x the long to print
134:             */
135:            public void println(long x) {
136:                synchronized (lock) {
137:                    print(x);
138:                    println();
139:                }
140:            }
141:
142:            /**
143:             * Print a float followed by a line separator.
144:             *
145:             * @param x the float to print
146:             */
147:            public void println(float x) {
148:                synchronized (lock) {
149:                    print(x);
150:                    println();
151:                }
152:            }
153:
154:            /**
155:             * Print a double followed by a line separator.
156:             *
157:             * @param x the double to print
158:             */
159:            public void println(double x) {
160:                synchronized (lock) {
161:                    print(x);
162:                    println();
163:                }
164:            }
165:
166:            /**
167:             * Print a character array followed by a line separator.
168:             *
169:             * @param x the character array to print
170:             */
171:            public void println(char[] x) {
172:                synchronized (lock) {
173:                    print(x);
174:                    println();
175:                }
176:            }
177:
178:            /**
179:             * Print a String followed by a line separator.
180:             *
181:             * @param x the String to print
182:             */
183:            public void println(String x) {
184:                synchronized (lock) {
185:                    print(x);
186:                    println();
187:                }
188:            }
189:
190:            /**
191:             * Print an Object followed by a line separator.
192:             *
193:             * @param x the Object to print
194:             */
195:            public void println(Object x) {
196:                synchronized (lock) {
197:                    print(x);
198:                    println();
199:                }
200:            }
201:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.