public class MiscellaneousUtil extends Object
Modifier and Type | Method and Description |
---|---|
static byte[] |
asBytes(InputStream in) |
static String |
getProperty(Properties properties,
String name,
String defaultValue)
Helper method to get the value of the property from a given property bag
|
static <T> T |
getProperty(Properties properties,
String name,
T defaultValue,
Class<? extends T> type)
Helper method to get the value of the property from a given property bag
This method will return a value with the type equal to the type
given by the Class type parameter.
|
static Properties |
loadProperties(String filePath)
Loads the properties from a given property file path
|
static byte[] |
serialize(Object data)
Helper method to serialize object into a byte array
|
public static String getProperty(Properties properties, String name, String defaultValue)
properties
- The property collectionname
- The name of the propertydefaultValue
- The default value for the propertypublic static <T> T getProperty(Properties properties, String name, T defaultValue, Class<? extends T> type)
properties
- Properties bagname
- Name of the propertydefaultValue
- Default valuetype
- Expected Type using Classpublic static Properties loadProperties(String filePath)
filePath
- Path of the property filepublic static byte[] serialize(Object data)
data
- The object to be serializedpublic static byte[] asBytes(InputStream in)
Copyright © 2005-2017 Apache Software Foundation. All Rights Reserved.