Java Utililty Methods Properties Create

List of utility methods to do Properties Create

  1. HOME
  2. Java
  3. P
  4. Properties Create

Description

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

Method

Properties splitArrayElementsIntoProperties(String[] array, String delimiter)
Take an array Strings and split each element based on the given delimiter.
return splitArrayElementsIntoProperties(array, delimiter, null);
Properties splitArrayElementsIntoProperties(String[] array, String delimiter)
split Array Elements Into Properties
return splitArrayElementsIntoProperties(array, delimiter, null);
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); 
Map toMap(byte[] source)
to Map
return toMap(toProperties(source));
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;
void toProperties(File properties, File xml, String comment)
Converts the given xml file to the given properties file.
toProperties(new FileOutputStream(properties), new FileInputStream(xml), comment);
Properties toProperties(FileInputStream fis)
to Properties
Properties props = new Properties();
try {
 props.load(fis);
} catch (IOException ioe) {
return props;


AltStyle によって変換されたページ (->オリジナル) /