KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > cocoon > components > validation > jaxp > JaxpInput


1 /*
2  * Copyright 1999-2005 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package org.apache.cocoon.components.validation.jaxp;
17
18 import java.io.InputStream JavaDoc;
19 import java.io.Reader JavaDoc;
20
21 import org.w3c.dom.ls.LSInput JavaDoc;
22 import org.xml.sax.InputSource JavaDoc;
23
24 /**
25  * <p>An implementation of the {@link LSInput} interface wrapping a nested
26  * {@link InputSource}.</p>
27  *
28  * @author <a HREF="mailto:pier@betaversion.org">Pier Fumagalli</a>
29  */

30 public class JaxpInput implements LSInput JavaDoc {
31
32     /** <p>The wrapped {@link InputSource} instance.</p> */
33     private final InputSource JavaDoc input;
34     /** <p>The flag to return by the {@link #getCertifiedText()} method.</p> */
35     private boolean cert = false;
36     /** <p>A string wrapping the data to parse.</p> */
37     private String JavaDoc data = null;
38     /** <p>The optional base URI for relative resolution.</p> */
39     private String JavaDoc base = null;
40
41     /**
42      * <p>Create a new {@link JaxpInput} instance.</p>
43      *
44      * @param input a <b>non-null</b> {@link InputSource} instance to wrap.
45      * @throws NullPointerException if the {@link InputSource} was <b>null</b>.
46      */

47     public JaxpInput(InputSource JavaDoc input) {
48         if (input == null) throw new NullPointerException JavaDoc("Null InputSource");
49         this.input = input;
50     }
51
52     public Reader JavaDoc getCharacterStream() {
53         return this.input.getCharacterStream();
54     }
55
56     public void setCharacterStream(Reader JavaDoc reader) {
57         this.input.setCharacterStream(reader);
58     }
59
60     public InputStream JavaDoc getByteStream() {
61         return this.input.getByteStream();
62     }
63
64     public void setByteStream(InputStream JavaDoc stream) {
65         this.input.setByteStream(stream);
66     }
67
68     public String JavaDoc getStringData() {
69         return this.data;
70     }
71
72     public void setStringData(String JavaDoc data) {
73         this.data = data;
74     }
75
76     public String JavaDoc getSystemId() {
77         return this.input.getSystemId();
78     }
79
80     public void setSystemId(String JavaDoc systemId) {
81         this.input.setSystemId(systemId);
82     }
83
84     public String JavaDoc getPublicId() {
85         return this.input.getPublicId();
86     }
87
88     public void setPublicId(String JavaDoc publicId) {
89         this.input.setPublicId(publicId);
90     }
91
92     public String JavaDoc getBaseURI() {
93         if (this.base != null) return this.base;
94         return this.input.getSystemId();
95     }
96
97     public void setBaseURI(String JavaDoc base) {
98         this.base = base;
99     }
100
101     public String JavaDoc getEncoding() {
102         return this.input.getEncoding();
103     }
104
105     public void setEncoding(String JavaDoc encoding) {
106         this.input.setEncoding(encoding);
107     }
108
109     public boolean getCertifiedText() {
110         return this.cert;
111     }
112
113     public void setCertifiedText(boolean cert) {
114         this.cert = cert;
115     }
116 }
Popular Tags