0% found this document useful (0 votes)
10 views

Java Util Properties

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views

Java Util Properties

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

JAVA.UTIL.

PROPERTIES CLASS
http://www.tutorialspoint.com/java/util/java_util_properties.htm Copyright © tutorialspoint.com

Introduction
The java.util.Properties class is a class which represents a persistent set of properties.The
Properties can be saved to a stream or loaded from a stream.Following are the important points
about Properties:

Each key and its corresponding value in the property list is a string.

A property list can contain another property list as its 'defaults', this second property list is
searched if the property key is not found in the original property list.

This class is thread-safe; multiple threads can share a single Properties object without the
need for external synchronization.

Class declaration
Following is the declaration for java.util.Properties class:

public class Properties


extends Hashtable<Object,Object>

Field
Following are the fields for java.util.Properties class:

protected Properties defaults -- This is the property list that contains default values for
any keys not found in this property list.

Class constructors

S.N. Constructor & Description

1
Properties

This constructs creates an empty property list with no default values.

2
PropertiesPropertiesdefaults

This constructs creates an empty property list with the specified defaults.

Class methods

S.N. Method & Description

1
String getPropertyStringkey

This method searches for the property with the specified key in this property list.

2
String getPropertyStringkey, StringdefaultValue
This method searches for the property with the specified key in this property list.

3
void listPrintStreamout

This method prints this property list out to the specified output stream.

4
void listPrintWriterout

This method prints this property list out to the specified output stream.

5
void loadInputStreaminStream

This method reads a property list keyandelementpairs from the input byte stream.

6
void loadReaderreader

This method reads a property list keyandelementpairs from the input character stream in a
simple line-oriented format.

7
void loadFromXMLInputStreamin

This method loads all of the properties represented by the XML document on the
specified input stream into this properties table.

8
Enumeration<?> propertyNames

This method returns an enumeration of all the keys in this property list, including distinct
keys in the default property list if a key of the same name has not already been found
from the main properties list.

9
void saveOutputStreamout, Stringcomments

This method reads a.

10
Object setPropertyStringkey, Stringvalue

This method calls the Hashtable method put.

11
void storeOutputStreamout, Stringcomments

The method writes this property list keyandelementpairs in this Properties table to the output
stream in a format suitable for loading into a Properties table using the loadInputStream
method.

12
void storeWriterwriter, Stringcomments

The method writes this property list keyandelementpairs in this Properties table to the output
character stream in a format suitable for using the loadReader method.
13
void storeToXMLOutputStreamos, Stringcomment

This method emits an XML document representing all of the properties contained in this
table.

14
void storeToXMLOutputStreamos, Stringcomment, Stringencoding

This method emits an XML document representing all of the properties contained in this
table, using the specified encoding.

15
Set<String> stringPropertyNames

This method returns a set of keys in this property list where the key and its corresponding
value are strings, including distinct keys in the default property list if a key of the same
name has not already been found from the main properties list.

Methods inherited
This class inherits methods from the following classes:

java.util.Hashtable
java.util.Object
Loading [MathJax]/jax/output/HTML-CSS/jax.js

You might also like