feat(jdk8): move files to new folder to avoid resources compiled.

This commit is contained in:
2025-09-07 15:25:52 +08:00
parent 3f0047bf6f
commit 8c35cfb1c0
17415 changed files with 217 additions and 213 deletions

View File

@@ -0,0 +1,144 @@
/*
* Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package javax.xml.transform.sax;
import javax.xml.transform.Result;
import org.xml.sax.ContentHandler;
import org.xml.sax.ext.LexicalHandler;
/**
* <p>Acts as an holder for a transformation Result.</p>
*
* @author <a href="Jeff.Suttor@Sun.com">Jeff Suttor</a>
*/
public class SAXResult implements Result {
/**
* If {@link javax.xml.transform.TransformerFactory#getFeature}
* returns true when passed this value as an argument,
* the Transformer supports Result output of this type.
*/
public static final String FEATURE =
"http://javax.xml.transform.sax.SAXResult/feature";
/**
* Zero-argument default constructor.
*/
public SAXResult() {
}
/**
* Create a SAXResult that targets a SAX2 {@link org.xml.sax.ContentHandler}.
*
* @param handler Must be a non-null ContentHandler reference.
*/
public SAXResult(ContentHandler handler) {
setHandler(handler);
}
/**
* Set the target to be a SAX2 {@link org.xml.sax.ContentHandler}.
*
* @param handler Must be a non-null ContentHandler reference.
*/
public void setHandler(ContentHandler handler) {
this.handler = handler;
}
/**
* Get the {@link org.xml.sax.ContentHandler} that is the Result.
*
* @return The ContentHandler that is to be transformation output.
*/
public ContentHandler getHandler() {
return handler;
}
/**
* Set the SAX2 {@link org.xml.sax.ext.LexicalHandler} for the output.
*
* <p>This is needed to handle XML comments and the like. If the
* lexical handler is not set, an attempt should be made by the
* transformer to cast the {@link org.xml.sax.ContentHandler} to a
* <code>LexicalHandler</code>.</p>
*
* @param handler A non-null <code>LexicalHandler</code> for
* handling lexical parse events.
*/
public void setLexicalHandler(LexicalHandler handler) {
this.lexhandler = handler;
}
/**
* Get a SAX2 {@link org.xml.sax.ext.LexicalHandler} for the output.
*
* @return A <code>LexicalHandler</code>, or null.
*/
public LexicalHandler getLexicalHandler() {
return lexhandler;
}
/**
* Method setSystemId Set the systemID that may be used in association
* with the {@link org.xml.sax.ContentHandler}.
*
* @param systemId The system identifier as a URI string.
*/
public void setSystemId(String systemId) {
this.systemId = systemId;
}
/**
* Get the system identifier that was set with setSystemId.
*
* @return The system identifier that was set with setSystemId, or null
* if setSystemId was not called.
*/
public String getSystemId() {
return systemId;
}
//////////////////////////////////////////////////////////////////////
// Internal state.
//////////////////////////////////////////////////////////////////////
/**
* The handler for parse events.
*/
private ContentHandler handler;
/**
* The handler for lexical events.
*/
private LexicalHandler lexhandler;
/**
* The systemID that may be used in association
* with the node.
*/
private String systemId;
}

View File

@@ -0,0 +1,209 @@
/*
* Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package javax.xml.transform.sax;
import javax.xml.transform.Source;
import javax.xml.transform.stream.StreamSource;
import org.xml.sax.InputSource;
import org.xml.sax.XMLReader;
/**
* <p>Acts as an holder for SAX-style Source.</p>
*
* <p>Note that XSLT requires namespace support. Attempting to transform an
* input source that is not
* generated with a namespace-aware parser may result in errors.
* Parsers can be made namespace aware by calling the
* {@link javax.xml.parsers.SAXParserFactory#setNamespaceAware(boolean awareness)} method.</p>
*
* @author <a href="mailto:Jeff.Suttor@Sun.com">Jeff Suttor</a>
*/
public class SAXSource implements Source {
/**
* If {@link javax.xml.transform.TransformerFactory#getFeature}
* returns true when passed this value as an argument,
* the Transformer supports Source input of this type.
*/
public static final String FEATURE =
"http://javax.xml.transform.sax.SAXSource/feature";
/**
* <p>Zero-argument default constructor. If this constructor is used, and
* no SAX source is set using
* {@link #setInputSource(InputSource inputSource)} , then the
* <code>Transformer</code> will
* create an empty source {@link org.xml.sax.InputSource} using
* {@link org.xml.sax.InputSource#InputSource() new InputSource()}.</p>
*
* @see javax.xml.transform.Transformer#transform(Source xmlSource, Result outputTarget)
*/
public SAXSource() { }
/**
* Create a <code>SAXSource</code>, using an {@link org.xml.sax.XMLReader}
* and a SAX InputSource. The {@link javax.xml.transform.Transformer}
* or {@link javax.xml.transform.sax.SAXTransformerFactory} will set itself
* to be the reader's {@link org.xml.sax.ContentHandler}, and then will call
* reader.parse(inputSource).
*
* @param reader An XMLReader to be used for the parse.
* @param inputSource A SAX input source reference that must be non-null
* and that will be passed to the reader parse method.
*/
public SAXSource(XMLReader reader, InputSource inputSource) {
this.reader = reader;
this.inputSource = inputSource;
}
/**
* Create a <code>SAXSource</code>, using a SAX <code>InputSource</code>.
* The {@link javax.xml.transform.Transformer} or
* {@link javax.xml.transform.sax.SAXTransformerFactory} creates a
* reader via {@link org.xml.sax.helpers.XMLReaderFactory}
* (if setXMLReader is not used), sets itself as
* the reader's {@link org.xml.sax.ContentHandler}, and calls
* reader.parse(inputSource).
*
* @param inputSource An input source reference that must be non-null
* and that will be passed to the parse method of the reader.
*/
public SAXSource(InputSource inputSource) {
this.inputSource = inputSource;
}
/**
* Set the XMLReader to be used for the Source.
*
* @param reader A valid XMLReader or XMLFilter reference.
*/
public void setXMLReader(XMLReader reader) {
this.reader = reader;
}
/**
* Get the XMLReader to be used for the Source.
*
* @return A valid XMLReader or XMLFilter reference, or null.
*/
public XMLReader getXMLReader() {
return reader;
}
/**
* Set the SAX InputSource to be used for the Source.
*
* @param inputSource A valid InputSource reference.
*/
public void setInputSource(InputSource inputSource) {
this.inputSource = inputSource;
}
/**
* Get the SAX InputSource to be used for the Source.
*
* @return A valid InputSource reference, or null.
*/
public InputSource getInputSource() {
return inputSource;
}
/**
* Set the system identifier for this Source. If an input source
* has already been set, it will set the system ID or that
* input source, otherwise it will create a new input source.
*
* <p>The system identifier is optional if there is a byte stream
* or a character stream, but it is still useful to provide one,
* since the application can use it to resolve relative URIs
* and can include it in error messages and warnings (the parser
* will attempt to open a connection to the URI only if
* no byte stream or character stream is specified).</p>
*
* @param systemId The system identifier as a URI string.
*/
public void setSystemId(String systemId) {
if (null == inputSource) {
inputSource = new InputSource(systemId);
} else {
inputSource.setSystemId(systemId);
}
}
/**
* <p>Get the base ID (URI or system ID) from where URIs
* will be resolved.</p>
*
* @return Base URL for the <code>Source</code>, or <code>null</code>.
*/
public String getSystemId() {
if (inputSource == null) {
return null;
} else {
return inputSource.getSystemId();
}
}
/**
* The XMLReader to be used for the source tree input. May be null.
*/
private XMLReader reader;
/**
* <p>The SAX InputSource to be used for the source tree input.
* Should not be <code>null</code>.</p>
*/
private InputSource inputSource;
/**
* Attempt to obtain a SAX InputSource object from a Source
* object.
*
* @param source Must be a non-null Source reference.
*
* @return An InputSource, or null if Source can not be converted.
*/
public static InputSource sourceToInputSource(Source source) {
if (source instanceof SAXSource) {
return ((SAXSource) source).getInputSource();
} else if (source instanceof StreamSource) {
StreamSource ss = (StreamSource) source;
InputSource isource = new InputSource(ss.getSystemId());
isource.setByteStream(ss.getInputStream());
isource.setCharacterStream(ss.getReader());
isource.setPublicId(ss.getPublicId());
return isource;
} else {
return null;
}
}
}

View File

@@ -0,0 +1,150 @@
/*
* Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package javax.xml.transform.sax;
import javax.xml.transform.*;
import org.xml.sax.XMLFilter;
/**
* This class extends TransformerFactory to provide SAX-specific
* factory methods. It provides two types of ContentHandlers,
* one for creating Transformers, the other for creating Templates
* objects.
*
* <p>If an application wants to set the ErrorHandler or EntityResolver
* for an XMLReader used during a transformation, it should use a URIResolver
* to return the SAXSource which provides (with getXMLReader) a reference to
* the XMLReader.</p>
*/
public abstract class SAXTransformerFactory extends TransformerFactory {
/** If {@link javax.xml.transform.TransformerFactory#getFeature}
* returns true when passed this value as an argument,
* the TransformerFactory returned from
* {@link javax.xml.transform.TransformerFactory#newInstance} may
* be safely cast to a SAXTransformerFactory.
*/
public static final String FEATURE =
"http://javax.xml.transform.sax.SAXTransformerFactory/feature";
/** If {@link javax.xml.transform.TransformerFactory#getFeature}
* returns true when passed this value as an argument,
* the {@link #newXMLFilter(Source src)}
* and {@link #newXMLFilter(Templates templates)} methods are supported.
*/
public static final String FEATURE_XMLFILTER =
"http://javax.xml.transform.sax.SAXTransformerFactory/feature/xmlfilter";
/**
* The default constructor is protected on purpose.
*/
protected SAXTransformerFactory() {}
/**
* Get a TransformerHandler object that can process SAX
* ContentHandler events into a Result, based on the transformation
* instructions specified by the argument.
*
* @param src The Source of the transformation instructions.
*
* @return TransformerHandler ready to transform SAX events.
*
* @throws TransformerConfigurationException If for some reason the
* TransformerHandler can not be created.
*/
public abstract TransformerHandler newTransformerHandler(Source src)
throws TransformerConfigurationException;
/**
* Get a TransformerHandler object that can process SAX
* ContentHandler events into a Result, based on the Templates argument.
*
* @param templates The compiled transformation instructions.
*
* @return TransformerHandler ready to transform SAX events.
*
* @throws TransformerConfigurationException If for some reason the
* TransformerHandler can not be created.
*/
public abstract TransformerHandler newTransformerHandler(
Templates templates) throws TransformerConfigurationException;
/**
* Get a TransformerHandler object that can process SAX
* ContentHandler events into a Result. The transformation
* is defined as an identity (or copy) transformation, for example
* to copy a series of SAX parse events into a DOM tree.
*
* @return A non-null reference to a TransformerHandler, that may
* be used as a ContentHandler for SAX parse events.
*
* @throws TransformerConfigurationException If for some reason the
* TransformerHandler cannot be created.
*/
public abstract TransformerHandler newTransformerHandler()
throws TransformerConfigurationException;
/**
* Get a TemplatesHandler object that can process SAX
* ContentHandler events into a Templates object.
*
* @return A non-null reference to a TransformerHandler, that may
* be used as a ContentHandler for SAX parse events.
*
* @throws TransformerConfigurationException If for some reason the
* TemplatesHandler cannot be created.
*/
public abstract TemplatesHandler newTemplatesHandler()
throws TransformerConfigurationException;
/**
* Create an XMLFilter that uses the given Source as the
* transformation instructions.
*
* @param src The Source of the transformation instructions.
*
* @return An XMLFilter object, or null if this feature is not supported.
*
* @throws TransformerConfigurationException If for some reason the
* TemplatesHandler cannot be created.
*/
public abstract XMLFilter newXMLFilter(Source src)
throws TransformerConfigurationException;
/**
* Create an XMLFilter, based on the Templates argument..
*
* @param templates The compiled transformation instructions.
*
* @return An XMLFilter object, or null if this feature is not supported.
*
* @throws TransformerConfigurationException If for some reason the
* TemplatesHandler cannot be created.
*/
public abstract XMLFilter newXMLFilter(Templates templates)
throws TransformerConfigurationException;
}

View File

@@ -0,0 +1,68 @@
/*
* Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package javax.xml.transform.sax;
import javax.xml.transform.*;
import org.xml.sax.ContentHandler;
/**
* A SAX ContentHandler that may be used to process SAX
* parse events (parsing transformation instructions) into a Templates object.
*
* <p>Note that TemplatesHandler does not need to implement LexicalHandler.</p>
*/
public interface TemplatesHandler extends ContentHandler {
/**
* When a TemplatesHandler object is used as a ContentHandler
* for the parsing of transformation instructions, it creates a Templates object,
* which the caller can get once the SAX events have been completed.
*
* @return The Templates object that was created during
* the SAX event process, or null if no Templates object has
* been created.
*
*/
public Templates getTemplates();
/**
* Set the base ID (URI or system ID) for the Templates object
* created by this builder. This must be set in order to
* resolve relative URIs in the stylesheet. This must be
* called before the startDocument event.
*
* @param systemID Base URI for this stylesheet.
*/
public void setSystemId(String systemID);
/**
* Get the base ID (URI or system ID) from where relative
* URLs will be resolved.
* @return The systemID that was set with {@link #setSystemId}.
*/
public String getSystemId();
}

View File

@@ -0,0 +1,76 @@
/*
* Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package javax.xml.transform.sax;
import javax.xml.transform.Result;
import javax.xml.transform.Transformer;
import org.xml.sax.ContentHandler;
import org.xml.sax.DTDHandler;
import org.xml.sax.ext.LexicalHandler;
/**
* A TransformerHandler
* listens for SAX ContentHandler parse events and transforms
* them to a Result.
*/
public interface TransformerHandler
extends ContentHandler, LexicalHandler, DTDHandler {
/**
* <p>Set the <code>Result</code> associated with this
* <code>TransformerHandler</code> to be used for the transformation.</p>
*
* @param result A <code>Result</code> instance, should not be
* <code>null</code>.
*
* @throws IllegalArgumentException if result is invalid for some reason.
*/
public void setResult(Result result) throws IllegalArgumentException;
/**
* Set the base ID (URI or system ID) from where relative
* URLs will be resolved.
* @param systemID Base URI for the source tree.
*/
public void setSystemId(String systemID);
/**
* Get the base ID (URI or system ID) from where relative
* URLs will be resolved.
* @return The systemID that was set with {@link #setSystemId}.
*/
public String getSystemId();
/**
* <p>Get the <code>Transformer</code> associated with this handler, which
* is needed in order to set parameters and output properties.</p>
*
* @return <code>Transformer</code> associated with this
* <code>TransformerHandler</code>.
*/
public Transformer getTransformer();
}