Source Code Cross Referenced for ToString.java in  » J2EE » wicket » wicket » util » diff » 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 » J2EE » wicket » wicket.util.diff 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * ====================================================================
003:         * 
004:         * The Apache Software License, Version 1.1
005:         * 
006:         * Copyright (c) 1999-2003 The Apache Software Foundation. All rights reserved.
007:         * 
008:         * Redistribution and use in source and binary forms, with or without
009:         * modification, are permitted provided that the following conditions are met:
010:         * 
011:         * 1. Redistributions of source code must retain the above copyright notice,
012:         * this list of conditions and the following disclaimer.
013:         * 
014:         * 2. Redistributions in binary form must reproduce the above copyright notice,
015:         * this list of conditions and the following disclaimer in the documentation
016:         * and/or other materials provided with the distribution.
017:         * 
018:         * 3. The end-user documentation included with the redistribution, if any, must
019:         * include the following acknowledgement: "This product includes software
020:         * developed by the Apache Software Foundation (http://www.apache.org/)."
021:         * Alternately, this acknowledgement may appear in the software itself, if and
022:         * wherever such third-party acknowledgements normally appear.
023:         * 
024:         * 4. The names "The Jakarta Project", "Commons", and "Apache Software
025:         * Foundation" must not be used to endorse or promote products derived from this
026:         * software without prior written permission. For written permission, please
027:         * contact apache@apache.org.
028:         * 
029:         * 5. Products derived from this software may not be called "Apache" nor may
030:         * "Apache" appear in their names without prior written permission of the Apache
031:         * Software Foundation.
032:         * 
033:         * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
034:         * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
035:         * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE
036:         * SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
037:         * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
038:         * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
039:         * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
040:         * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
041:         * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
042:         * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
043:         * ====================================================================
044:         * 
045:         * This software consists of voluntary contributions made by many individuals on
046:         * behalf of the Apache Software Foundation. For more information on the Apache
047:         * Software Foundation, please see <http://www.apache.org/>.
048:         * 
049:         */
050:
051:        package wicket.util.diff;
052:
053:        import java.io.BufferedReader;
054:        import java.io.StringReader;
055:        import java.util.LinkedList;
056:        import java.util.List;
057:
058:        /**
059:         * This class delegates handling of the to a StringBuffer based version.
060:         * 
061:         * @version $Revision: 1.1 $ $Date: 2006/03/12 00:24:21 $
062:         * @author <a href="mailto:juanco@suigeneris.org">Juanco Anez</a>
063:         */
064:        public class ToString {
065:            /**
066:             * Construct.
067:             */
068:            public ToString() {
069:            }
070:
071:            /**
072:             * Default implementation of the
073:             * {@link java.lang.Object#toString toString() } method that delegates work
074:             * to a {@link java.lang.StringBuffer StringBuffer} base version.
075:             * @return String
076:             */
077:            public String toString() {
078:                StringBuffer s = new StringBuffer();
079:                toString(s);
080:                return s.toString();
081:            }
082:
083:            /**
084:             * Place a string image of the object in a StringBuffer.
085:             * 
086:             * @param s
087:             *            the string buffer.
088:             */
089:            public void toString(StringBuffer s) {
090:                s.append(super .toString());
091:            }
092:
093:            /**
094:             * Breaks a string into an array of strings. Use the value of the
095:             * <code>line.separator</code> system property as the linebreak character.
096:             * 
097:             * @param value
098:             *            the string to convert.
099:             * @return String[]
100:             */
101:            public static String[] stringToArray(String value) {
102:                BufferedReader reader = new BufferedReader(new StringReader(
103:                        value));
104:                List l = new LinkedList();
105:                String s;
106:                try {
107:                    while ((s = reader.readLine()) != null) {
108:                        l.add(s);
109:                    }
110:                } catch (java.io.IOException e) {
111:                }
112:                return (String[]) l.toArray(new String[l.size()]);
113:            }
114:
115:            /**
116:             * Converts an array of {@link Object Object} to a string Use the value of
117:             * the <code>line.separator</code> system property the line separator.
118:             * 
119:             * @param o
120:             *            the array of objects.
121:             * @return String
122:             */
123:            public static String arrayToString(Object[] o) {
124:                return arrayToString(o, System.getProperty("line.separator"));
125:            }
126:
127:            /**
128:             * Converts an array of {@link Object Object} to a string using the given
129:             * line separator.
130:             * 
131:             * @param o
132:             *            the array of objects.
133:             * @param EOL
134:             *            the string to use as line separator.
135:             * @return String
136:             */
137:            public static String arrayToString(Object[] o, String EOL) {
138:                StringBuffer buf = new StringBuffer();
139:                for (int i = 0; i < o.length - 1; i++) {
140:                    buf.append(o[i]);
141:                    buf.append(EOL);
142:                }
143:                buf.append(o[o.length - 1]);
144:                return buf.toString();
145:            }
146:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.