Module JavaProperties

module JavaProperties: sig .. end
Utility functions for Java properties.


Instance creation

 
type t = java'util'Properties java_instance
The type of properties.
 
val make : ?defaults:t -> unit -> t
Returns a new java.util.Properties instance, with the passed defaults if not null, empty otherwise.
 

Properties retrieval

 
val get_property : t -> JavaString.t -> JavaString.t option
get_property props key returns the value of the property whose key is key in props if found, None otherwise; see getProperty(...).
 
val get_property_default : t -> JavaString.t -> JavaString.t -> JavaString.t
get_property_default props key def returns the value of the property whose key is key in props if found, def otherwise; see getProperty(...).
 
val string_property_names : t -> JavaString.t list
string_property_names props returns the list of the keys for the properties defined in props (including defaults); see stringPropertyNames(...).
 

Properties modification

 
val set_property : t -> JavaString.t -> JavaString.t -> JavaString.t option
set_property props key value set the property with key key to value value in props, returning the previous value if any; see setProperty(...).
 

I/O operations

 
val load : t -> java'io'InputStream java_extends -> unit
load props str loads the properties from stream str into props; see load(...).
Raises Java_exception if an i/o error occurs
 
val load_from_xml : t -> java'io'InputStream java_extends -> unit
load_xml props str loads the properties from stream str into props; see loadFromXML(...).
Raises Java_exception if an i/o error occurs
 
val store : t ->
?comment:JavaString.t -> java'io'OutputStream java_extends -> unit
store props str stores the properties props onto the stream str with optional comment commment; see store(...).
Raises Java_exception if an i/o error occurs
 
val store_to_xml : t ->
?comment:JavaString.t -> java'io'OutputStream java_extends -> unit
store_to_xml props str stores the properties props onto the stream str with optional comment commment; see storeToXML(...).
Raises Java_exception if an i/o error occurs
 

Null value

 
val null : t
The null value.
 
val is_null : t -> bool
is_null obj returns true iff obj is equal to null.
 
val is_not_null : t -> bool
is_not_null obj returns false iff obj is equal to null.
 

Miscellaneous

 
val wrap : t -> t option
wrap obj wraps the reference obj into an option type:
  • Some x if obj is not null;
  • None if obj is null.

 
val unwrap : t option -> t
unwrap obj unwraps the option obj into a bare reference:
  • Some x is mapped to x;
  • None is mapped to null.