The list of methods to do Properties Create are organized into topic(s).
Dictionary
toDictionary(Map properties) to Dictionary
if (properties == null) {
return null;
return new Hashtable<Object, Object>(properties);
String
toFileContent(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);
String
toPrettyPrintJSON(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);
...
Properties
toProperties(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;
Properties
toProperties(byte[] source) to Properties
Properties rc = new Properties();
rc.load(new ByteArrayInputStream(source));
return rc;