KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > opencms > template > CmsProcessedString


1 /*
2 * File : $Source: /usr/local/cvs/opencms/src-modules/com/opencms/template/CmsProcessedString.java,v $
3 * Date : $Date: 2005/05/17 13:47:32 $
4 * Version: $Revision: 1.1 $
5 *
6 * This library is part of OpenCms -
7 * the Open Source Content Mananagement System
8 *
9 * Copyright (C) 2001 The OpenCms Group
10 *
11 * This library is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU Lesser General Public
13 * License as published by the Free Software Foundation; either
14 * version 2.1 of the License, or (at your option) any later version.
15 *
16 * This library is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * Lesser General Public License for more details.
20 *
21 * For further information about OpenCms, please see the
22 * OpenCms Website: http://www.opencms.org
23 *
24 * You should have received a copy of the GNU Lesser General Public
25 * License along with this library; if not, write to the Free Software
26 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27 */

28
29 package com.opencms.template;
30
31 import java.io.UnsupportedEncodingException JavaDoc;
32
33 /**
34  * Special class for String results returned in template engine.
35  * Template objects should use this class instead of <code>String</code>
36  * if they have written their results to the response output stream
37  * theirselves (if the system is in streaming mode).
38  * <P>
39  * If an object doesn't care about HTTP streaming and simply generates
40  * a String for returning to the template engine, it really shouldn't
41  * make use of this class and return the original String.
42  *
43  * @author Alexander Lucas
44  * @version $Revision: 1.1 $ $Date: 2005/05/17 13:47:32 $
45  *
46  * @deprecated Will not be supported past the OpenCms 6 release.
47  */

48 public class CmsProcessedString {
49
50     /** Store for the original String. */
51     String JavaDoc m_orgString;
52
53     /**
54      * Constructor for a new CmsProcessedString object.<p>
55      *
56      * @param s the original String
57      */

58     public CmsProcessedString(String JavaDoc s) {
59         m_orgString = s;
60     }
61
62     /**
63      * Constructor for a new CmsProcessedString object.<p>
64      *
65      * @param b the byte array to create the String from
66      * @param encoding the encoding of the byte array
67      */

68     public CmsProcessedString(byte[] b, String JavaDoc encoding) {
69         if (b == null) {
70             m_orgString = null;
71         } else {
72             try {
73                 m_orgString = new String JavaDoc(b, encoding);
74             } catch (UnsupportedEncodingException JavaDoc uee) {
75                 m_orgString = new String JavaDoc(b);
76             }
77         }
78     }
79
80     /**
81      * Get back the original String.<p>
82      *
83      * @return the original String
84      */

85     public String JavaDoc toString() {
86         return m_orgString;
87     }
88 }
89
Popular Tags