1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one
3  * or more contributor license agreements. See the NOTICE file
4  * distributed with this work for additional information
5  * regarding copyright ownership. The ASF licenses this file
6  * to you under the Apache License, Version 2.0 (the  "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  *     http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */
18 /*
19  * $Id: XMLStringFactory.java 468655 2006-10-28 07:12:06Z minchau $
20  */
21 package org.apache.xml.utils;
22 
23 /**
24  * A concrete class that implements this interface creates XMLString objects.
25  */
26 public abstract class XMLStringFactory
27 {
28 
29   /**
30    * Create a new XMLString from a Java string.
31    *
32    *
33    * @param string Java String reference, which must be non-null.
34    *
35    * @return An XMLString object that wraps the String reference.
36    */
newstr(String string)37   public abstract XMLString newstr(String string);
38 
39   /**
40    * Create a XMLString from a FastStringBuffer.
41    *
42    *
43    * @param string FastStringBuffer reference, which must be non-null.
44    * @param start The start position in the array.
45    * @param length The number of characters to read from the array.
46    *
47    * @return An XMLString object that wraps the FastStringBuffer reference.
48    */
newstr(FastStringBuffer string, int start, int length)49   public abstract XMLString newstr(FastStringBuffer string, int start,
50                                    int length);
51 
52   /**
53    * Create a XMLString from a FastStringBuffer.
54    *
55    *
56    * @param string FastStringBuffer reference, which must be non-null.
57    * @param start The start position in the array.
58    * @param length The number of characters to read from the array.
59    *
60    * @return An XMLString object that wraps the FastStringBuffer reference.
61    */
newstr(char[] string, int start, int length)62   public abstract XMLString newstr(char[] string, int start,
63                                    int length);
64 
65   /**
66    * Get a cheap representation of an empty string.
67    *
68    * @return An non-null reference to an XMLString that represents "".
69    */
emptystr()70   public abstract XMLString emptystr();
71 }
72