KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > xb > binding > sunday > unmarshalling > LSInputAdaptor


1 /*
2   * JBoss, Home of Professional Open Source
3   * Copyright 2005, JBoss Inc., and individual contributors as indicated
4   * by the @authors tag. See the copyright.txt in the distribution for a
5   * full listing of individual contributors.
6   *
7   * This is free software; you can redistribute it and/or modify it
8   * under the terms of the GNU Lesser General Public License as
9   * published by the Free Software Foundation; either version 2.1 of
10   * the License, or (at your option) any later version.
11   *
12   * This software is distributed in the hope that it will be useful,
13   * but WITHOUT ANY WARRANTY; without even the implied warranty of
14   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15   * Lesser General Public License for more details.
16   *
17   * You should have received a copy of the GNU Lesser General Public
18   * License along with this software; if not, write to the Free
19   * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20   * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21   */

22 package org.jboss.xb.binding.sunday.unmarshalling;
23
24 import java.io.InputStream JavaDoc;
25 import java.io.Reader JavaDoc;
26
27 import org.w3c.dom.ls.LSInput JavaDoc;
28
29 /**
30  * A simple implementation of the dom3 LSInput
31  *
32  * @author Scott.Stark@jboss.org
33  * @version $Revision: 1958 $
34  */

35 public class LSInputAdaptor
36    implements LSInput JavaDoc
37 {
38    private String JavaDoc baseURI;
39    private String JavaDoc publicId;
40    private String JavaDoc systemId;
41    private String JavaDoc encoding;
42    private InputStream JavaDoc byteStream;
43    private Reader JavaDoc characterStream;
44    private String JavaDoc stringData;
45    private boolean certifiedText;
46
47    public LSInputAdaptor(String JavaDoc publicId, String JavaDoc systemId, String JavaDoc baseURI)
48    {
49       this.publicId = publicId;
50       this.systemId = systemId;
51       this.baseURI = baseURI;
52    }
53
54    public LSInputAdaptor(InputStream JavaDoc is, String JavaDoc encoding)
55    {
56       setByteStream(is);
57       setEncoding(encoding);
58    }
59
60    public LSInputAdaptor(Reader JavaDoc charStream, String JavaDoc encoding)
61    {
62       this.setCharacterStream(charStream);
63       setEncoding(encoding);
64    }
65
66    public LSInputAdaptor(String JavaDoc data, String JavaDoc encoding)
67    {
68       this.setStringData(data);
69       setEncoding(encoding);
70    }
71
72    public String JavaDoc getBaseURI()
73    {
74       return baseURI;
75    }
76
77    public void setBaseURI(String JavaDoc baseURI)
78    {
79       this.baseURI = baseURI;
80    }
81
82    public String JavaDoc getPublicId()
83    {
84       return publicId;
85    }
86
87    public void setPublicId(String JavaDoc publicId)
88    {
89       this.publicId = publicId;
90    }
91
92    public String JavaDoc getSystemId()
93    {
94       return systemId;
95    }
96
97    public void setSystemId(String JavaDoc systemId)
98    {
99       this.systemId = systemId;
100    }
101
102    public InputStream JavaDoc getByteStream()
103    {
104       return byteStream;
105    }
106
107    public void setByteStream(InputStream JavaDoc is)
108    {
109       this.byteStream = is;
110    }
111
112    public Reader JavaDoc getCharacterStream()
113    {
114       return characterStream;
115    }
116
117    public void setCharacterStream(Reader JavaDoc reader)
118    {
119       this.characterStream = reader;
120    }
121
122    public String JavaDoc getStringData()
123    {
124       return stringData;
125    }
126
127    public void setStringData(String JavaDoc stringData)
128    {
129       this.stringData = stringData;
130    }
131
132    public String JavaDoc getEncoding()
133    {
134       return encoding;
135    }
136
137    public void setEncoding(String JavaDoc encoding)
138    {
139       this.encoding = encoding;
140    }
141
142    public boolean getCertifiedText()
143    {
144       return certifiedText;
145    }
146
147    public void setCertifiedText(boolean flag)
148    {
149       this.certifiedText = flag;
150    }
151 }
152
Popular Tags