public class Utils
extends com.streamscape.repository.types.AbstractSemanticFactory
Title: Framework Support Library
Description: Contains various useful utilities.
Copyright: Copyright (c) 2010
Company: StreamScape Technologies
DEFAULT_SERIAL_VERSION_ID
Constructor and Description |
---|
Utils() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
bytesToHex(byte[] bytes) |
static java.util.HashMap |
createMap(java.lang.Object key,
java.lang.Object value) |
static boolean |
equals(java.util.Collection list1,
java.util.Collection list2) |
static boolean |
equals(java.util.Collection list1,
java.lang.Object[] list2) |
static boolean |
equalsNullSafe(java.util.Collection list1,
java.util.Collection list2) |
static boolean |
equalsNullSafe(java.util.Map map1,
java.util.Map map2) |
static boolean |
equalsNullSafe(java.lang.Object object1,
java.lang.Object object2) |
static java.lang.String |
formatException(java.lang.Throwable exception) |
static java.lang.String |
formatException(java.lang.Throwable exception,
java.lang.String separator) |
static void |
formatException(java.lang.Throwable exception,
java.lang.String separator,
java.lang.StringBuilder result) |
static java.lang.String |
formatExceptionWithUnrepeatedCauses(java.lang.Throwable exception) |
static java.lang.String |
formatExceptionWithUnrepeatedCauses(java.lang.Throwable exception,
java.lang.String separator) |
static java.lang.Object |
getCause(java.lang.Throwable exception,
java.lang.Class causeClazz) |
static java.lang.Object |
getCauseAssignable(java.lang.Throwable exception,
java.lang.Class causeClazz) |
static boolean |
isEmpty(java.util.Collection list) |
static int |
min(int a,
long b)
Returns a minimum of the two specified values.
|
static byte[] |
readByteArray(java.io.DataInputStream input) |
static int |
readInt(java.io.InputStream in) |
static long |
readLong(java.io.InputStream in) |
static void |
recreate(java.util.Map map) |
static java.util.Map |
removeAll(java.util.Map from,
java.util.Map removedValues) |
static boolean |
sleep(long timeout)
Causes a current thread to sleep for the specified timeout (in milliseconds).
|
static boolean |
sleepNoInterrupt(long timeout)
Causes a current thread to sleep for the specified timeout (in milliseconds) without resetting the interrupted state
after catching an
InterruptedException . |
static java.lang.String |
toTimeString(long time)
Returns a string representation of the specified time period (in milliseconds).
|
static java.lang.Throwable |
unwrapInvokeException(java.lang.Throwable exception) |
static void |
writeInt(int v,
java.io.OutputStream out) |
static void |
writeLong(long v,
java.io.OutputStream out) |
clone, getSerialVersionUID
public static boolean equalsNullSafe(java.lang.Object object1, java.lang.Object object2)
public static boolean equalsNullSafe(java.util.Collection list1, java.util.Collection list2)
public static boolean equals(java.util.Collection list1, java.util.Collection list2)
public static boolean equals(java.util.Collection list1, java.lang.Object[] list2)
public static boolean equalsNullSafe(java.util.Map map1, java.util.Map map2)
public static boolean isEmpty(java.util.Collection list)
public static boolean sleep(long timeout)
timeout
- the time of thread sleeping.true
if the sleep has been successfully completed, false
if the sleep has been interrupted.public static boolean sleepNoInterrupt(long timeout)
InterruptedException
.timeout
- the time of thread sleeping.true
if the sleep has been successfully completed, false
if the sleep has been interrupted.public static java.lang.String formatException(java.lang.Throwable exception)
public static java.lang.String formatException(java.lang.Throwable exception, java.lang.String separator)
public static void formatException(java.lang.Throwable exception, java.lang.String separator, java.lang.StringBuilder result)
public static java.lang.String formatExceptionWithUnrepeatedCauses(java.lang.Throwable exception)
public static java.lang.String formatExceptionWithUnrepeatedCauses(java.lang.Throwable exception, java.lang.String separator)
public static java.lang.Throwable unwrapInvokeException(java.lang.Throwable exception)
public static java.lang.Object getCause(java.lang.Throwable exception, java.lang.Class causeClazz)
public static java.lang.Object getCauseAssignable(java.lang.Throwable exception, java.lang.Class causeClazz)
public static java.lang.String toTimeString(long time)
H...H:mm:ss.SSS
,
where H
- hours, m
- minutes, s
- seconds, S
- milliseconds.
Examples: 00:00:10.500
, 12:34:56.789
, 1200.00.50.100
.time
- the specified time period (in milliseconds).public static int min(int a, long b)
a
- the first value to be compared.b
- the second value to be compared.public static byte[] readByteArray(java.io.DataInputStream input) throws java.io.IOException
java.io.IOException
public static int readInt(java.io.InputStream in) throws java.io.IOException
java.io.IOException
public static void writeInt(int v, java.io.OutputStream out) throws java.io.IOException
java.io.IOException
public static long readLong(java.io.InputStream in) throws java.io.IOException
java.io.IOException
public static void writeLong(long v, java.io.OutputStream out) throws java.io.IOException
java.io.IOException
public static java.lang.String bytesToHex(byte[] bytes)
public static java.util.Map removeAll(java.util.Map from, java.util.Map removedValues)
public static void recreate(java.util.Map map)
public static java.util.HashMap createMap(java.lang.Object key, java.lang.Object value)
Copyright © 2015-2024 StreamScape Technologies. All rights reserved.