1 /*
2 * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
3 * @LastModified: Oct 2017
4 */
5 /*
6 * Licensed to the Apache Software Foundation (ASF) under one or more
7 * contributor license agreements. See the NOTICE file distributed with
8 * this work for additional information regarding copyright ownership.
9 * The ASF licenses this file to You under the Apache License, Version 2.0
10 * (the "License"); you may not use this file except in compliance with
11 * the License. You may obtain a copy of the License at
12 *
13 * http://www.apache.org/licenses/LICENSE-2.0
14 *
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
20 */
21
22 package com.sun.org.apache.xerces.internal.xinclude;
23
46
47 /**
48 * This class is used for reading resources requested in <include> elements,
49 * when the parse attribute of the <include> element is "text". Using this
50 * class will open the location, detect the encoding, and discard the byte order
51 * mark, if applicable.
52 *
53 * REVISIT:
54 * Much of the code in this class is taken from XMLEntityManager. It would be nice
55 * if this code could be shared in some way. However, since XMLEntityManager is used
56 * for reading files as XML, and this needs to read files as text, there would need
57 * to be some refactoring done.
58 *
59 * @author Michael Glavassevich, IBM
60 * @author Peter McCracken, IBM
61 * @author Ankit Pasricha, IBM
62 * @author Arun Yadav, Sun Microsystems Inc.
63 *
64 *
65 * @see XIncludeHandler
66 */
67 public class XIncludeTextReader {
68
69 private Reader fReader;
70 private XIncludeHandler fHandler;
71 private XMLInputSource fSource;
72 private XMLErrorReporter fErrorReporter;
73 private XMLString fTempString = new XMLString();
74
75 /**
76 * Construct the XIncludeReader using the XMLInputSource and XIncludeHandler.
77 *
78 * @param source The XMLInputSource to use.
79 * @param handler The XIncludeHandler to use.
80 * @param bufferSize The size of this text reader's buffer.
81 */
82 public XIncludeTextReader(XMLInputSource source, XIncludeHandler handler, int bufferSize)
83 throws IOException {
84 fHandler = handler;
85 fSource = source;
|
1 /*
2 * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
3 */
4 /*
5 * Licensed to the Apache Software Foundation (ASF) under one or more
6 * contributor license agreements. See the NOTICE file distributed with
7 * this work for additional information regarding copyright ownership.
8 * The ASF licenses this file to You under the Apache License, Version 2.0
9 * (the "License"); you may not use this file except in compliance with
10 * the License. You may obtain a copy of the License at
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 */
20
21 package com.sun.org.apache.xerces.internal.xinclude;
22
45
46 /**
47 * This class is used for reading resources requested in <include> elements,
48 * when the parse attribute of the <include> element is "text". Using this
49 * class will open the location, detect the encoding, and discard the byte order
50 * mark, if applicable.
51 *
52 * REVISIT:
53 * Much of the code in this class is taken from XMLEntityManager. It would be nice
54 * if this code could be shared in some way. However, since XMLEntityManager is used
55 * for reading files as XML, and this needs to read files as text, there would need
56 * to be some refactoring done.
57 *
58 * @author Michael Glavassevich, IBM
59 * @author Peter McCracken, IBM
60 * @author Ankit Pasricha, IBM
61 * @author Arun Yadav, Sun Microsystems Inc.
62 *
63 *
64 * @see XIncludeHandler
65 * @LastModified: Oct 2017
66 */
67 public class XIncludeTextReader {
68
69 private Reader fReader;
70 private XIncludeHandler fHandler;
71 private XMLInputSource fSource;
72 private XMLErrorReporter fErrorReporter;
73 private XMLString fTempString = new XMLString();
74
75 /**
76 * Construct the XIncludeReader using the XMLInputSource and XIncludeHandler.
77 *
78 * @param source The XMLInputSource to use.
79 * @param handler The XIncludeHandler to use.
80 * @param bufferSize The size of this text reader's buffer.
81 */
82 public XIncludeTextReader(XMLInputSource source, XIncludeHandler handler, int bufferSize)
83 throws IOException {
84 fHandler = handler;
85 fSource = source;
|