Properties Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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
- 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
| Name | Description |
|---|---|
| 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
| Name | Description |
|---|---|
| Class |
Returns the runtime class of this |
| 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 |
Gets the identity hash code assigned to this Java peer by the interop runtime. (Inherited from Object) |
| JniManagedPeerState |
Gets the state flags last assigned by the runtime. (Inherited from JavaObject) |
| JniPeerMembers |
Gets the JNI metadata used to access members of this Java binding. |
| PeerReference |
Gets the JNI object reference for this Java peer. (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
| Name | Description |
|---|---|
| Clone() |
Creates and returns a copy of this object. (Inherited from Object) |
| Compute(Object, IBiFunction) |
Computes a value for a key from its current mapping, if any. |
| ComputeIfAbsent(Object, IFunction) |
Computes and stores a value only when this object has no entry for the key. |
| ComputeIfPresent(Object, IBiFunction) |
Computes a replacement only when this object contains an entry for the key. |
| Construct(JniObjectReference, JniObjectReferenceOptions) |
Delegates construction of this peer to the runtime's value manager. (Inherited from JavaObject) |
| Dispose() |
Releases the resources held by this Java peer. (Inherited from Object) |
| Dispose(Boolean) |
Releases the resources held by this Java peer. (Inherited from Object) |
| DisposeUnlessReferenced() |
Asks the value manager to dispose this peer unless its mapping retains this same managed instance. (Inherited from JavaObject) |
| Equals(Object) |
Tests whether another managed peer refers to the same Java object. (Inherited from JavaObject) |
| Equals(Object) |
Indicates whether some other object is "equal to" this one. (Inherited from Object) |
| ForEach(IBiConsumer) |
Calls the specified operation for each entry stored in this object. |
| GetHashCode() |
Returns a hash code value for the object. (Inherited from Object) |
| GetOrDefault(Object, Object) |
Looks up a local entry and uses the specified result when the key is absent. |
| 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() |
Obsolete.
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) |
Adds a value for an absent key or combines it with an existing local value. |
| 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) |
Adds or replaces a local key-value entry. |
| PutAll(IDictionary<Object,Object>) |
Adds the supplied map's entries, replacing local values for matching keys. |
| PutIfAbsent(Object, Object) |
Adds a local entry only when this object has no entry for the key. |
| Replace(Object, Object, Object) |
Changes a local entry only when its current value matches the expected value. |
| Replace(Object, Object) |
Changes the value of an existing local entry. |
| ReplaceAll(IBiFunction) |
Updates each local entry's value with the result of the specified function. |
| Save(Stream, String) |
Obsolete.
Calls the |
| SetHandle(IntPtr, JniHandleOwnership) |
Sets the Handle property. (Inherited from Object) |
| SetPeerReference(JniObjectReference, JniObjectReferenceOptions) |
Stores a reference value in the control block without creating a JNI reference copy. (Inherited from JavaObject) |
| SetProperty(String, String) |
Calls the |
| Store(Stream, String) |
Writes this property list (key and element pairs) in this
|
| Store(Writer, String) |
Writes this property list (key and element pairs) in this
|
| StoreToXML(Stream, String, Charset) |
Emits an XML document representing all of the properties contained in this table, using the specified encoding. |
| 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>() |
Creates a managed array from this Java array wrapper. (Inherited from Object) |
| ToString() |
Returns a string representation of the object. (Inherited from Object) |
| UnregisterFromRuntime() |
Unregisters this Java peer from the interop runtime. (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
| Name | Description |
|---|---|
| IJavaPeerable.Disposed() |
Marks this peer as disposed and calls |
| IJavaPeerable.Finalized() |
Marks this peer as disposed and calls |
| IJavaPeerable.JniObjectReferenceControlBlock |
Gets the native control-block pointer used by this peer. (Inherited from JavaObject) |
| IJavaPeerable.SetJniIdentityHashCode(Int32) |
Stores the identity hash code supplied by the runtime. (Inherited from JavaObject) |
| IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) |
Replaces the stored managed peer state flags. (Inherited from JavaObject) |
| IJavaPeerable.SetPeerReference(JniObjectReference) |
Updates the peer reference and releases a disposed peer's control block when the reference is invalid. (Inherited from JavaObject) |
Extension Methods
| Name | Description |
|---|---|
| GetJniTypeName(IJavaPeerable) |
Gets the JNI name of the type of the instance |
| JavaAs<TResult>(IJavaPeerable) |
Try to coerce |
| JavaCast<TResult>(IJavaObject) |
Performs an Android runtime-checked type conversion. |
| JavaCast<TResult>(IJavaObject) |
Reuses a compatible managed peer or obtains a wrapper of the requested type. |
| TryJavaCast<TResult>(IJavaPeerable, TResult) |
Try to coerce |