public class Utils
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
EVAL_ABS |
static int |
EVAL_ADD |
static int |
EVAL_DIV |
static int |
EVAL_FORMAT |
static int |
EVAL_MUL |
static int |
EVAL_NONE |
static int |
EVAL_PARSE |
static int |
EVAL_SUB |
static java.lang.String |
FS |
static int |
RESULT_BYTES |
static int |
RESULT_COLLECTIBLE |
static int |
RESULT_JSON |
static int |
RESULT_LIST |
static int |
RESULT_POSTABLE |
static int |
RESULT_SET |
static int |
RESULT_TEXT |
static int |
RESULT_XML |
static java.lang.String |
RS |
Constructor and Description |
---|
Utils() |
Modifier and Type | Method and Description |
---|---|
static java.util.List<java.lang.Object> |
cloneProperties(java.util.List props)
It returns a List with fully cloned properties
|
static java.util.Map<java.lang.String,java.lang.Object> |
cloneProperties(java.util.Map props)
It returns a Map with fully cloned properties
|
static boolean |
compareProperties(java.util.List la,
java.util.List lb)
compares two property lists and returns true only if they are same
|
static boolean |
compareProperties(java.util.Map pa,
java.util.Map pb)
compares two property maps and returns true only if they are same
|
static int |
copyListProps(java.lang.String name,
java.util.Map<java.lang.String,java.lang.Object> target,
java.util.Map source)
It copies the properties from the source to the target according to
a given list of the name defined in the target.
|
static long |
copyStream(java.io.InputStream in,
java.io.OutputStream out,
byte[] buffer,
int count)
It copies bytes from the InputStream and writes them into the
OutputStream.
|
static java.lang.String[] |
copyStream(java.io.InputStream in,
java.io.OutputStream out1,
java.io.OutputStream out2,
byte[] buffer,
int count,
long[] rc)
It copies bytes from the InputStream and writes them into two
OutputStreams.
|
static java.lang.String |
dateFormat(java.util.Date date) |
static java.lang.String |
decode(java.lang.String str) |
static java.lang.String |
decrypt(java.lang.String text)
decrypts the encrypted text with OpenSSL plugin
|
static java.util.Map<java.lang.String,java.lang.Object> |
diff(java.lang.String base,
java.util.Map<java.lang.String,java.lang.Object> includeGroup,
java.util.Map ps,
java.util.Map pt)
It returns a Map with only modified or new props.
|
static java.lang.String |
doSearchReplace(java.lang.String s,
java.lang.String r,
java.lang.String text) |
static java.lang.String |
encode(java.lang.String str) |
static java.lang.String |
escapeJSON(java.lang.String text) |
static java.lang.String |
escapeXML(java.lang.String text) |
static double |
evaluate(double a,
double b,
int option) |
static long |
evaluate(long a,
long b,
int option) |
static java.util.Map<java.lang.String,java.lang.String> |
evaluate(org.w3c.dom.Node nd,
java.util.Map expression)
evaluates the node with xpath expressions stored in the expression map
and returns the key-value map for the node
|
static void |
flush(java.lang.Throwable e)
It prints out error msg and rethrows it if it is an Error
|
static java.lang.Object |
getDeclaredConstant(java.lang.String classname,
java.lang.String name,
java.lang.String prefix)
returns the object for the contant value of the field in the class
|
static javax.xml.parsers.DocumentBuilder |
getDocBuilder() |
static java.lang.String |
getHttpHeader(java.lang.String key,
java.lang.String headers)
It returns the value of the http header for the key or null if there is
no such key in the headers.
|
static java.lang.String[] |
getIncludes(java.lang.String basename,
java.util.Map<java.lang.String,java.lang.Object> includeGroup,
java.util.Map props)
It returns an array of names for the primary includes based on the given
IncludeGroup, the basename and the master propery map.
|
static java.util.Map<java.lang.String,java.lang.Object> |
getMasterProperties(java.lang.String base,
java.util.Map<java.lang.String,java.lang.Object> includeGroup,
java.util.Map props) |
static int |
getOutstandingSize(XQueue xq,
int begin,
int len)
returns number of outstanding messages for the given xqueue
|
static java.lang.String |
getParent(java.lang.String filename)
It returns dirname of the filename or null if it is a relative path.
|
static java.lang.String |
getParentNameSpaces(org.w3c.dom.Node nd)
aggregates all attributes of name spaces from the parent nodes on
a given node and returns the string of attributes or null if no NS
|
static java.util.Map<java.lang.String,java.lang.String> |
getUniqueMap(java.util.Collection list)
It returns a unique Map with dup count from the given list
|
static byte[] |
hexString2Bytes(java.lang.String hexStr)
returns a byte array for the number of the hex string
|
static int |
linearInterpolate(double x,
double y,
double span,
double delta,
double[][] result)
It assumes the data points linearly distributed between (x-span, 0) and
(x, y).
|
static java.util.Map<java.lang.String,java.lang.Object> |
migrateProperties(java.util.Map props)
It returns a Map with migrated properties
|
static java.lang.String |
nodeListToText(org.w3c.dom.NodeList list)
converts a DOM NodeList into the text representation of the hierachy.
|
static java.lang.String |
nodeToText(org.w3c.dom.Node nd)
converts a DOM node into the text representation of the hierachy.
|
static java.util.Map<java.lang.String,java.lang.Object> |
normalize(java.util.Map props,
java.lang.String key)
It assumes the Map contains a list of the given key.
|
static java.util.Date |
parseDate(java.lang.String date) |
static int |
projectProps(java.lang.String key,
java.util.Map ph)
It assumes a property map contains a list of names as the value for
the key, their property maps and others.
|
static java.lang.String |
read(java.io.InputStream in,
byte[] buffer) |
static byte[] |
sign(byte[] msg,
java.lang.String key,
java.lang.String algorithm) |
static java.lang.String[] |
split(java.lang.String s,
java.lang.String text)
splits the text with delimiter of s and returns a string array with
each key separated by the delimiters.
|
static int |
split(java.lang.String s,
java.lang.String e,
java.lang.String text,
java.util.Map<java.lang.String,java.lang.String> attr)
splits text with delimiter of s and fills the key-value pair to the Map
after replacing all the escaped delimiters by the original delimiter.
|
static java.lang.String |
toJSON(java.util.Map data) |
static java.lang.String |
toJSON(java.util.Map data,
java.lang.String[] attrs) |
static java.lang.String |
traceStack(java.lang.Throwable e) |
static java.lang.String |
unescapeJSON(java.lang.String text) |
static double[] |
uniformSpread(double x,
double span,
double delta)
It assumes the data points of x-axis uniformly distributed in the
interval of [x - span, x].
|
public static final int EVAL_NONE
public static final int EVAL_ADD
public static final int EVAL_SUB
public static final int EVAL_MUL
public static final int EVAL_DIV
public static final int EVAL_ABS
public static final int EVAL_PARSE
public static final int EVAL_FORMAT
public static final int RESULT_TEXT
public static final int RESULT_BYTES
public static final int RESULT_XML
public static final int RESULT_JSON
public static final int RESULT_LIST
public static final int RESULT_SET
public static final int RESULT_POSTABLE
public static final int RESULT_COLLECTIBLE
public static final java.lang.String FS
public static final java.lang.String RS
public static void flush(java.lang.Throwable e)
public static java.lang.String traceStack(java.lang.Throwable e)
public static java.lang.String dateFormat(java.util.Date date)
public static java.util.Date parseDate(java.lang.String date)
public static java.lang.String escapeJSON(java.lang.String text)
public static java.lang.String unescapeJSON(java.lang.String text)
public static java.lang.String toJSON(java.util.Map data)
public static java.lang.String toJSON(java.util.Map data, java.lang.String[] attrs)
public static java.lang.String escapeXML(java.lang.String text)
public static java.lang.String doSearchReplace(java.lang.String s, java.lang.String r, java.lang.String text)
public static int split(java.lang.String s, java.lang.String e, java.lang.String text, java.util.Map<java.lang.String,java.lang.String> attr)
public static java.lang.String[] split(java.lang.String s, java.lang.String text)
public static int linearInterpolate(double x, double y, double span, double delta, double[][] result)
public static double[] uniformSpread(double x, double span, double delta)
public static double evaluate(double a, double b, int option)
public static long evaluate(long a, long b, int option)
public static int projectProps(java.lang.String key, java.util.Map ph)
public static int copyListProps(java.lang.String name, java.util.Map<java.lang.String,java.lang.Object> target, java.util.Map source)
public static java.lang.String[] getIncludes(java.lang.String basename, java.util.Map<java.lang.String,java.lang.Object> includeGroup, java.util.Map props)
public static java.util.Map<java.lang.String,java.lang.Object> diff(java.lang.String base, java.util.Map<java.lang.String,java.lang.Object> includeGroup, java.util.Map ps, java.util.Map pt)
public static java.util.Map<java.lang.String,java.lang.String> getUniqueMap(java.util.Collection list)
public static java.util.Map<java.lang.String,java.lang.Object> normalize(java.util.Map props, java.lang.String key)
public static java.util.Map<java.lang.String,java.lang.Object> getMasterProperties(java.lang.String base, java.util.Map<java.lang.String,java.lang.Object> includeGroup, java.util.Map props)
public static java.util.Map<java.lang.String,java.lang.Object> migrateProperties(java.util.Map props)
public static java.util.Map<java.lang.String,java.lang.Object> cloneProperties(java.util.Map props)
public static java.util.List<java.lang.Object> cloneProperties(java.util.List props)
public static boolean compareProperties(java.util.Map pa, java.util.Map pb)
public static boolean compareProperties(java.util.List la, java.util.List lb)
public static java.lang.Object getDeclaredConstant(java.lang.String classname, java.lang.String name, java.lang.String prefix)
public static byte[] hexString2Bytes(java.lang.String hexStr)
public static javax.xml.parsers.DocumentBuilder getDocBuilder() throws javax.xml.parsers.ParserConfigurationException
javax.xml.parsers.ParserConfigurationException
public static java.lang.String nodeToText(org.w3c.dom.Node nd)
public static java.lang.String nodeListToText(org.w3c.dom.NodeList list)
public static java.lang.String getParentNameSpaces(org.w3c.dom.Node nd)
public static java.util.Map<java.lang.String,java.lang.String> evaluate(org.w3c.dom.Node nd, java.util.Map expression)
public static long copyStream(java.io.InputStream in, java.io.OutputStream out, byte[] buffer, int count) throws java.io.IOException
java.io.IOException
public static java.lang.String[] copyStream(java.io.InputStream in, java.io.OutputStream out1, java.io.OutputStream out2, byte[] buffer, int count, long[] rc) throws java.io.IOException
java.io.IOException
public static java.lang.String read(java.io.InputStream in, byte[] buffer) throws java.io.IOException
java.io.IOException
public static byte[] sign(byte[] msg, java.lang.String key, java.lang.String algorithm) throws java.security.InvalidKeyException, java.security.NoSuchAlgorithmException
java.security.InvalidKeyException
java.security.NoSuchAlgorithmException
public static java.lang.String encode(java.lang.String str) throws java.io.IOException
java.io.IOException
public static java.lang.String decode(java.lang.String str) throws java.io.IOException
java.io.IOException
public static int getOutstandingSize(XQueue xq, int begin, int len)
public static java.lang.String decrypt(java.lang.String text) throws java.io.IOException, java.security.GeneralSecurityException
java.io.IOException
java.security.GeneralSecurityException
public static java.lang.String getParent(java.lang.String filename)
public static java.lang.String getHttpHeader(java.lang.String key, java.lang.String headers)