Share via


Properties Class

Definition

The Properties class represents a persistent set of properties.

[Android.Runtime.Register("java/util/Properties", DoNotGenerateAcw=true)]
public class Properties : Java.Lang.Object
[<Android.Runtime.Register("java/util/Properties", DoNotGenerateAcw=true)>]
type Properties = class
    inherit Object
Inheritance
Properties
Derived
Attributes

Remarks

The Properties class represents a persistent set of properties. The Properties can be saved to a stream or loaded from a stream. 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.

Because Properties inherits from Hashtable, the put and putAll methods can be applied to a Properties object. Their use is strongly discouraged as they allow the caller to insert entries whose keys or values are not Strings. The setProperty method should be used instead. If the store or save method is called on a "compromised" Properties object that contains a non-String key or value, the call will fail. Similarly, the call to the propertyNames or list method will fail if it is called on a "compromised" Properties object that contains a non-String key.

The iterators returned by the iterator method of this class's "collection views" (that is, entrySet(), keySet(), and values()) may not fail-fast (unlike the Hashtable implementation). These iterators are guaranteed to traverse elements as they existed upon construction exactly once, and may (but are not guaranteed to) reflect any modifications subsequent to construction.

The #load(java.io.Reader) load(Reader)/#store(java.io.Writer, java.lang.String) store(Writer, String) methods load and store properties from and to a character based stream in a simple line-oriented format specified below.

The #load(java.io.InputStream) load(InputStream)/#store(java.io.OutputStream, java.lang.String) store(OutputStream, String) methods work the same way as the load(Reader)/store(Writer, String) pair, except the input/output stream is encoded in ISO 8859-1 character encoding. Characters that cannot be directly represented in this encoding can be written using Unicode escapes as defined in section {

Added in 1.0.

Java documentation for java.util.Properties.

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Constructors

Properties()

Creates an empty property list with no default values.

Properties(Int32)

Creates an empty property list with no default values, and with an initial size accommodating the specified number of elements without the need to dynamically resize.

Properties(IntPtr, JniHandleOwnership)

A constructor used when creating managed representations of JNI objects; called by the runtime.

Properties(Properties)

Creates an empty property list with the specified defaults.

Properties

Class

Returns the runtime class of this Object.

(Inherited from Object)
Defaults

A property list that contains default values for any keys not found in this property list.

Handle

The handle to the underlying Android instance.

(Inherited from Object)
JniIdentityHashCode (Inherited from Object)
JniPeerMembers
PeerReference (Inherited from Object)
ThresholdClass

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

ThresholdType

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

Methods

Clone()

Creates and returns a copy of this object.

(Inherited from Object)
Compute(Object, IBiFunction)
ComputeIfAbsent(Object, IFunction)
ComputeIfPresent(Object, IBiFunction)
Dispose() (Inherited from Object)
Dispose(Boolean) (Inherited from Object)
Equals(Object)

Indicates whether some other object is "equal to" this one.

(Inherited from Object)
ForEach(IBiConsumer)
GetHashCode()

Returns a hash code value for the object.

(Inherited from Object)
GetOrDefault(Object, Object)
GetProperty(String, String)

Searches for the property with the specified key in this property list.

GetProperty(String)

Searches for the property with the specified key in this property list.

JavaFinalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

(Inherited from Object)
List(PrintStream)

Prints this property list out to the specified output stream.

List(PrintWriter)

Prints this property list out to the specified output stream.

Load(Reader)

Reads a property list (key and element pairs) from the input character stream in a simple line-oriented format.

Load(Stream)

Reads a property list (key and element pairs) from the input byte stream.

LoadFromXML(Stream)

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

Merge(Object, Object, IBiFunction)
Notify()

Wakes up a single thread that is waiting on this object's monitor.

(Inherited from Object)
NotifyAll()

Wakes up all threads that are waiting on this object's monitor.

(Inherited from Object)
PropertyNames()

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.

Put(Object, Object)
PutAll(IDictionary<Object,Object>)
PutIfAbsent(Object, Object)
Replace(Object, Object, Object)
Replace(Object, Object)
ReplaceAll(IBiFunction)
Save(Stream, String)
Obsolete.

Calls the store(OutputStream out, String comments) method and suppresses IOExceptions that were thrown.

SetHandle(IntPtr, JniHandleOwnership)

Sets the Handle property.

(Inherited from Object)
SetProperty(String, String)

Calls the Hashtable method put.

Store(Stream, String)

Writes this property list (key and element pairs) in this Properties table to the output stream in a format suitable for loading into a Properties table using the #load(InputStream) load(InputStream) method.

Store(Writer, String)

Writes this property list (key and element pairs) in this Properties table to the output character stream in a format suitable for using the #load(java.io.Reader) load(Reader) method.

StoreToXML(Stream, String, Charset)
StoreToXML(Stream, String, String)

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

StoreToXML(Stream, String)

Emits an XML document representing all of the properties contained in this table.

StringPropertyNames()

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.

ToArray<T>() (Inherited from Object)
ToString()

Returns a string representation of the object.

(Inherited from Object)
UnregisterFromRuntime() (Inherited from Object)
Wait()

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>.

(Inherited from Object)
Wait(Int64, Int32)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)
Wait(Int64)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)

Explicit Interface Implementations

IJavaPeerable.Disposed() (Inherited from Object)
IJavaPeerable.DisposeUnlessReferenced() (Inherited from Object)
IJavaPeerable.Finalized() (Inherited from Object)
IJavaPeerable.JniManagedPeerState (Inherited from Object)
IJavaPeerable.SetJniIdentityHashCode(Int32) (Inherited from Object)
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) (Inherited from Object)
IJavaPeerable.SetPeerReference(JniObjectReference) (Inherited from Object)

Extension Methods

JavaCast<TResult>(IJavaObject)

Performs an Android runtime-checked type conversion.

JavaCast<TResult>(IJavaObject)
GetJniTypeName(IJavaPeerable)

Gets the JNI name of the type of the instance self.

JavaAs<TResult>(IJavaPeerable)

Try to coerce self to type TResult, checking that the coercion is valid on the Java side.

TryJavaCast<TResult>(IJavaPeerable, TResult)

Try to coerce self to type TResult, checking that the coercion is valid on the Java side.

Applies to