Path: blob/aarch64-shenandoah-jdk8u272-b10/jaxp/src/org/xml/sax/ext/Locator2Impl.java
48576 views
/*1* Copyright (c) 2004, 2005, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425// Locator2Impl.java - extended LocatorImpl26// http://www.saxproject.org27// Public Domain: no warranty.28// $Id: Locator2Impl.java,v 1.2 2004/11/03 22:49:08 jsuttor Exp $2930package org.xml.sax.ext;3132import org.xml.sax.Locator;33import org.xml.sax.helpers.LocatorImpl;343536/**37* SAX2 extension helper for holding additional Entity information,38* implementing the {@link Locator2} interface.39*40* <blockquote>41* <em>This module, both source code and documentation, is in the42* Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>43* </blockquote>44*45* <p> This is not part of core-only SAX2 distributions.</p>46*47* @since SAX 2.0.248* @author David Brownell49*/50public class Locator2Impl extends LocatorImpl implements Locator251{52private String encoding;53private String version;545556/**57* Construct a new, empty Locator2Impl object.58* This will not normally be useful, since the main purpose59* of this class is to make a snapshot of an existing Locator.60*/61public Locator2Impl () { }6263/**64* Copy an existing Locator or Locator2 object.65* If the object implements Locator2, values of the66* <em>encoding</em> and <em>version</em>strings are copied,67* otherwise they set to <em>null</em>.68*69* @param locator The existing Locator object.70*/71public Locator2Impl (Locator locator)72{73super (locator);74if (locator instanceof Locator2) {75Locator2 l2 = (Locator2) locator;7677version = l2.getXMLVersion ();78encoding = l2.getEncoding ();79}80}8182////////////////////////////////////////////////////////////////////83// Locator2 method implementations84////////////////////////////////////////////////////////////////////8586/**87* Returns the current value of the version property.88*89* @see #setXMLVersion90*/91public String getXMLVersion ()92{ return version; }9394/**95* Returns the current value of the encoding property.96*97* @see #setEncoding98*/99public String getEncoding ()100{ return encoding; }101102103////////////////////////////////////////////////////////////////////104// Setters105////////////////////////////////////////////////////////////////////106107/**108* Assigns the current value of the version property.109*110* @param version the new "version" value111* @see #getXMLVersion112*/113public void setXMLVersion (String version)114{ this.version = version; }115116/**117* Assigns the current value of the encoding property.118*119* @param encoding the new "encoding" value120* @see #getEncoding121*/122public void setEncoding (String encoding)123{ this.encoding = encoding; }124}125126127