src/java.xml/share/classes/com/sun/org/apache/xerces/internal/xni/parser/XMLInputSource.java

Print this page




   4  */
   5 /*
   6  * Copyright 2000-2002,2004 The Apache Software Foundation.
   7  *
   8  * Licensed under the Apache License, Version 2.0 (the "License");
   9  * you may not use this file except in compliance with the License.
  10  * 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.xni.parser;
  22 
  23 import com.sun.org.apache.xerces.internal.xni.XMLResourceIdentifier;
  24 
  25 import java.io.InputStream;
  26 import java.io.Reader;

  27 
  28 /**
  29  * This class represents an input source for an XML document. The
  30  * basic properties of an input source are the following:
  31  * <ul>
  32  *  <li>public identifier</li>
  33  *  <li>system identifier</li>
  34  *  <li>byte stream or character stream</li>
  35  *  <li>
  36  * </ul>
  37  *
  38  * @author Andy Clark, IBM
  39  *
  40  */
  41 public class XMLInputSource {
  42 
  43     //
  44     // Data
  45     //
  46 


  89                           String baseSystemId, boolean isCreatedByResolver) {
  90         fPublicId = publicId;
  91         fSystemId = systemId;
  92         fBaseSystemId = baseSystemId;
  93         fIsCreatedByResolver = isCreatedByResolver;
  94     } // <init>(String,String,String)
  95 
  96     /**
  97      * Constructs an input source from a XMLResourceIdentifier
  98      * object, leaving resolution of the entity and opening of
  99      * the input stream up to the caller.
 100      *
 101      * @param resourceIdentifier    the XMLResourceIdentifier containing the information
 102      */
 103     public XMLInputSource(XMLResourceIdentifier resourceIdentifier) {
 104 
 105         fPublicId = resourceIdentifier.getPublicId();
 106         fSystemId = resourceIdentifier.getLiteralSystemId();
 107         fBaseSystemId = resourceIdentifier.getBaseSystemId();
 108     } // <init>(XMLResourceIdentifier)

















 109 
 110     /**
 111      * Constructs an input source from a byte stream.
 112      *
 113      * @param publicId     The public identifier, if known.
 114      * @param systemId     The system identifier. This value should
 115      *                     always be set, if possible, and can be
 116      *                     relative or absolute. If the system identifier
 117      *                     is relative, then the base system identifier
 118      *                     should be set.
 119      * @param baseSystemId The base system identifier. This value should
 120      *                     always be set to the fully expanded URI of the
 121      *                     base system identifier, if possible.
 122      * @param byteStream   The byte stream.
 123      * @param encoding     The encoding of the byte stream, if known.
 124      */
 125     public XMLInputSource(String publicId, String systemId,
 126                           String baseSystemId, InputStream byteStream,
 127                           String encoding) {
 128         fPublicId = publicId;




   4  */
   5 /*
   6  * Copyright 2000-2002,2004 The Apache Software Foundation.
   7  *
   8  * Licensed under the Apache License, Version 2.0 (the "License");
   9  * you may not use this file except in compliance with the License.
  10  * 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.xni.parser;
  22 
  23 import com.sun.org.apache.xerces.internal.xni.XMLResourceIdentifier;

  24 import java.io.InputStream;
  25 import java.io.Reader;
  26 import org.xml.sax.InputSource;
  27 
  28 /**
  29  * This class represents an input source for an XML document. The
  30  * basic properties of an input source are the following:
  31  * <ul>
  32  *  <li>public identifier</li>
  33  *  <li>system identifier</li>
  34  *  <li>byte stream or character stream</li>
  35  *  <li>
  36  * </ul>
  37  *
  38  * @author Andy Clark, IBM
  39  *
  40  */
  41 public class XMLInputSource {
  42 
  43     //
  44     // Data
  45     //
  46 


  89                           String baseSystemId, boolean isCreatedByResolver) {
  90         fPublicId = publicId;
  91         fSystemId = systemId;
  92         fBaseSystemId = baseSystemId;
  93         fIsCreatedByResolver = isCreatedByResolver;
  94     } // <init>(String,String,String)
  95 
  96     /**
  97      * Constructs an input source from a XMLResourceIdentifier
  98      * object, leaving resolution of the entity and opening of
  99      * the input stream up to the caller.
 100      *
 101      * @param resourceIdentifier    the XMLResourceIdentifier containing the information
 102      */
 103     public XMLInputSource(XMLResourceIdentifier resourceIdentifier) {
 104 
 105         fPublicId = resourceIdentifier.getPublicId();
 106         fSystemId = resourceIdentifier.getLiteralSystemId();
 107         fBaseSystemId = resourceIdentifier.getBaseSystemId();
 108     } // <init>(XMLResourceIdentifier)
 109 
 110     /**
 111      * Constructs an input source from a SAX InputSource
 112      * object.
 113      *
 114      * @param inputSource  a SAX InputSource
 115      * @param isCreatedByResolver a flag to indicate whether the source is
 116      * created by a resolver
 117      */
 118     public XMLInputSource(InputSource inputSource, boolean isCreatedByResolver) {
 119         fPublicId = inputSource.getPublicId();
 120         fSystemId = inputSource.getSystemId();
 121         fByteStream = inputSource.getByteStream();
 122         fCharStream = inputSource.getCharacterStream();
 123         fEncoding = inputSource.getEncoding();
 124         fIsCreatedByResolver = isCreatedByResolver;
 125     }
 126 
 127     /**
 128      * Constructs an input source from a byte stream.
 129      *
 130      * @param publicId     The public identifier, if known.
 131      * @param systemId     The system identifier. This value should
 132      *                     always be set, if possible, and can be
 133      *                     relative or absolute. If the system identifier
 134      *                     is relative, then the base system identifier
 135      *                     should be set.
 136      * @param baseSystemId The base system identifier. This value should
 137      *                     always be set to the fully expanded URI of the
 138      *                     base system identifier, if possible.
 139      * @param byteStream   The byte stream.
 140      * @param encoding     The encoding of the byte stream, if known.
 141      */
 142     public XMLInputSource(String publicId, String systemId,
 143                           String baseSystemId, InputStream byteStream,
 144                           String encoding) {
 145         fPublicId = publicId;