< prev index next >

src/java.base/share/classes/java/util/Properties.java

Print this page
rev 51958 : 8211122: Reduce the number of internal classes made accessible to jdk.unsupported
Reviewed-by: alanb, dfuchs, kvn
   1 /*
   2  * Copyright (c) 1995, 2017, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   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
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


  29 import java.io.PrintStream;
  30 import java.io.PrintWriter;
  31 import java.io.InputStream;
  32 import java.io.OutputStream;
  33 import java.io.Reader;
  34 import java.io.Writer;
  35 import java.io.OutputStreamWriter;
  36 import java.io.BufferedWriter;
  37 import java.io.ObjectInputStream;
  38 import java.io.ObjectOutputStream;
  39 import java.io.StreamCorruptedException;
  40 import java.io.UnsupportedEncodingException;
  41 import java.nio.charset.Charset;
  42 import java.nio.charset.IllegalCharsetNameException;
  43 import java.nio.charset.UnsupportedCharsetException;
  44 import java.util.concurrent.ConcurrentHashMap;
  45 import java.util.function.BiConsumer;
  46 import java.util.function.BiFunction;
  47 import java.util.function.Function;
  48 
  49 import jdk.internal.misc.SharedSecrets;
  50 import jdk.internal.misc.Unsafe;
  51 import jdk.internal.util.xml.PropertiesDefaultHandler;
  52 
  53 /**
  54  * The {@code Properties} class represents a persistent set of
  55  * properties. The {@code Properties} can be saved to a stream
  56  * or loaded from a stream. Each key and its corresponding value in
  57  * the property list is a string.
  58  * <p>
  59  * A property list can contain another property list as its
  60  * "defaults"; this second property list is searched if
  61  * the property key is not found in the original property list.
  62  * <p>
  63  * Because {@code Properties} inherits from {@code Hashtable}, the
  64  * {@code put} and {@code putAll} methods can be applied to a
  65  * {@code Properties} object.  Their use is strongly discouraged as they
  66  * allow the caller to insert entries whose keys or values are not
  67  * {@code Strings}.  The {@code setProperty} method should be used
  68  * instead.  If the {@code store} or {@code save} method is called
  69  * on a "compromised" {@code Properties} object that contains a


   1 /*
   2  * Copyright (c) 1995, 2018, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   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
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


  29 import java.io.PrintStream;
  30 import java.io.PrintWriter;
  31 import java.io.InputStream;
  32 import java.io.OutputStream;
  33 import java.io.Reader;
  34 import java.io.Writer;
  35 import java.io.OutputStreamWriter;
  36 import java.io.BufferedWriter;
  37 import java.io.ObjectInputStream;
  38 import java.io.ObjectOutputStream;
  39 import java.io.StreamCorruptedException;
  40 import java.io.UnsupportedEncodingException;
  41 import java.nio.charset.Charset;
  42 import java.nio.charset.IllegalCharsetNameException;
  43 import java.nio.charset.UnsupportedCharsetException;
  44 import java.util.concurrent.ConcurrentHashMap;
  45 import java.util.function.BiConsumer;
  46 import java.util.function.BiFunction;
  47 import java.util.function.Function;
  48 
  49 import jdk.internal.access.SharedSecrets;
  50 import jdk.internal.misc.Unsafe;
  51 import jdk.internal.util.xml.PropertiesDefaultHandler;
  52 
  53 /**
  54  * The {@code Properties} class represents a persistent set of
  55  * properties. The {@code Properties} can be saved to a stream
  56  * or loaded from a stream. Each key and its corresponding value in
  57  * the property list is a string.
  58  * <p>
  59  * A property list can contain another property list as its
  60  * "defaults"; this second property list is searched if
  61  * the property key is not found in the original property list.
  62  * <p>
  63  * Because {@code Properties} inherits from {@code Hashtable}, the
  64  * {@code put} and {@code putAll} methods can be applied to a
  65  * {@code Properties} object.  Their use is strongly discouraged as they
  66  * allow the caller to insert entries whose keys or values are not
  67  * {@code Strings}.  The {@code setProperty} method should be used
  68  * instead.  If the {@code store} or {@code save} method is called
  69  * on a "compromised" {@code Properties} object that contains a


< prev index next >