Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/classes/sun/util/spi/XmlPropertiesProvider.java
38918 views
/*1* Copyright (c) 2012, 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*/2425package sun.util.spi;2627import java.util.Properties;28import java.util.InvalidPropertiesFormatException;29import java.io.InputStream;30import java.io.OutputStream;31import java.io.IOException;3233/**34* Service-provider class for loading and storing {@link Properites} in XML35* format.36*37* @see Properties#loadFromXML38* @see Properties#storeToXML39*/4041public abstract class XmlPropertiesProvider {4243/**44* Initializes a new instance of this class.45*/46protected XmlPropertiesProvider() {47// do nothing for now48}4950/**51* Loads all of the properties represented by the XML document on the52* specified input stream into a properties table.53*54* @param props the properties table to populate55* @param in the input stream from which to read the XML document56* @throws IOException if reading from the specified input stream fails57* @throws java.io.UnsupportedEncodingException if the document's encoding58* declaration can be read and it specifies an encoding that is not59* supported60* @throws InvalidPropertiesFormatException Data on input stream does not61* constitute a valid XML document with the mandated document type.62*63* @see Properties#loadFromXML64*/65public abstract void load(Properties props, InputStream in)66throws IOException, InvalidPropertiesFormatException;6768/**69* Emits an XML document representing all of the properties in a given70* table.71*72* @param props the properies to store73* @param out the output stream on which to emit the XML document.74* @param comment a description of the property list, can be @{code null}75* @param encoding the name of a supported character encoding76*77* @throws IOException if writing to the specified output stream fails78* @throws java.io.UnsupportedEncodingException if the encoding is not79* supported by the implementation80* @throws NullPointerException if {@code out} is null.81* @throws ClassCastException if this {@code Properties} object82* contains any keys or values that are not83* {@code Strings}.84*85* @see Properties#storeToXML86*/87public abstract void store(Properties props, OutputStream out,88String comment, String encoding)89throws IOException;90}919293