jaxp/src/java.xml/share/classes/javax/xml/transform/sax/SAXSource.java
changeset 34983 cab976ee6f21
parent 25868 686eef1e7a79
child 47043 70b6df26bd98
equal deleted inserted replaced
34918:80f67512daa1 34983:cab976ee6f21
     1 /*
     1 /*
     2  * Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
   145      * will attempt to open a connection to the URI only if
   145      * will attempt to open a connection to the URI only if
   146      * no byte stream or character stream is specified).</p>
   146      * no byte stream or character stream is specified).</p>
   147      *
   147      *
   148      * @param systemId The system identifier as a URI string.
   148      * @param systemId The system identifier as a URI string.
   149      */
   149      */
       
   150     @Override
   150     public void setSystemId(String systemId) {
   151     public void setSystemId(String systemId) {
   151 
   152 
   152         if (null == inputSource) {
   153         if (null == inputSource) {
   153             inputSource = new InputSource(systemId);
   154             inputSource = new InputSource(systemId);
   154         } else {
   155         } else {
   160      * <p>Get the base ID (URI or system ID) from where URIs
   161      * <p>Get the base ID (URI or system ID) from where URIs
   161      * will be resolved.</p>
   162      * will be resolved.</p>
   162      *
   163      *
   163      * @return Base URL for the <code>Source</code>, or <code>null</code>.
   164      * @return Base URL for the <code>Source</code>, or <code>null</code>.
   164      */
   165      */
       
   166     @Override
   165     public String getSystemId() {
   167     public String getSystemId() {
   166 
   168 
   167         if (inputSource == null) {
   169         if (inputSource == null) {
   168             return null;
   170             return null;
   169         } else {
   171         } else {
   205             return isource;
   207             return isource;
   206         } else {
   208         } else {
   207             return null;
   209             return null;
   208         }
   210         }
   209     }
   211     }
       
   212 
       
   213     /**
       
   214      * Indicates whether the {@code SAXSource} object is empty. Empty is
       
   215      * defined as follows:
       
   216      * <ul>
       
   217      * <li>if the system identifier and {@code InputSource} are {@code null};
       
   218      * </li>
       
   219      * <li>if the system identifier is {@code null}, and the {@code InputSource}
       
   220      * is empty.
       
   221      * </li>
       
   222      * </ul>
       
   223      *
       
   224      * @return true if the {@code SAXSource} object is empty, false otherwise
       
   225      */
       
   226     @Override
       
   227     public boolean isEmpty() {
       
   228         return getSystemId() == null && (inputSource == null || inputSource.isEmpty());
       
   229     }
   210 }
   230 }