Java Utililty Methods Properties Create

List of utility methods to do Properties Create

Description

The list of methods to do Properties Create are organized into topic(s).

Method

PropertiessplitArrayElementsIntoProperties(String[] array, String delimiter)
Take an array Strings and split each element based on the given delimiter.
return splitArrayElementsIntoProperties(array, delimiter, null);
PropertiessplitArrayElementsIntoProperties(String[] array, String delimiter)
split Array Elements Into Properties
return splitArrayElementsIntoProperties(array, delimiter, null);
DictionarytoDictionary(Map properties)
to Dictionary
if (properties == null) {
    return null;
return new Hashtable<Object, Object>(properties);
StringtoFileContent(Properties props)
Converts properties to file storage format
try {
    StringWriter writer = new StringWriter();
    props.store(writer, "");
    return writer.toString();
} catch (IOException ioe) {
    throw new IllegalStateException(ioe); 
MaptoMap(byte[] source)
to Map
return toMap(toProperties(source));
StringtoPrettyPrintJSON(Object object)
to Pretty Print JSON
ObjectMapper mapper = new ObjectMapper();
mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
mapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);
mapper.enable(SerializationFeature.INDENT_OUTPUT);
StringWriter writer = new StringWriter();
try {
    mapper.writeValue(writer, object);
...
PropertiestoProperties(byte[] source)
to Properties
Properties rc = new Properties();
if (source != null) {
    try {
        rc.load(new ByteArrayInputStream(source));
    } catch (IOException ex) {
        throw new IllegalArgumentException("Cannot load properties", ex);
return rc;
PropertiestoProperties(byte[] source)
to Properties
Properties rc = new Properties();
rc.load(new ByteArrayInputStream(source));
return rc;
voidtoProperties(File properties, File xml, String comment)
Converts the given xml file to the given properties file.
toProperties(new FileOutputStream(properties), new FileInputStream(xml), comment);
PropertiestoProperties(FileInputStream fis)
to Properties
Properties props = new Properties();
try {
    props.load(fis);
} catch (IOException ioe) {
return props;