public class PlatformUtils extends PlatformUtilsBase
currentTimeOverride
Constructor and Description |
---|
PlatformUtils() |
Modifier and Type | Method and Description |
---|---|
static void |
arraycopy(java.lang.Object src,
int srcPos,
java.lang.Object dest,
int destPos,
int length)
Copies the number of
length elements of the Array src
starting at the offset srcPos into the Array dest at
the position destPos . |
static void |
copyBytes(byte[] src,
int srcPos,
byte[] dest,
int destPos,
int length)
Copy data from source byte array to destination byte array.
|
static void |
copyChars(char[] src,
int srcPos,
char[] dest,
int destPos,
int length)
Copy data from source char array to destination char array.
|
static void |
copyChars(java.lang.String src,
int srcPos,
char[] dest,
int destPos,
int length)
Copy characters from source string to destination char array.
|
static <T> T |
defaultValue() |
static long |
doubleToRawLongBits(double value)
Encode a double in a long.
|
static void |
exit(int code)
Causes the virtual machine to stop running and the program to exit.
|
static java.lang.String |
getExceptionDescription(java.lang.Throwable e)
Get the message + stack trace associated with this exception.
|
static java.lang.String |
getLineSeparator()
Get the default line separator (typically newline or carriage return/newline) for the platform.
|
static long |
platformGetCurrentTimeMillis()
Get the number of milliseconds since Jan 1, 1970, UTC time.
|
static double |
rawLongBitsToDouble(long value)
Encode a long in a double.
|
static void |
sleep(int sleepTimeInMilliseconds)
Make the current thread sleep for the specified number of milliseconds.
|
static void |
useSystemProxy()
Use the whatever proxy settings are configured in the OS.
|
getCurrentTimeMillis, setCurrentTimeOverride
public static long platformGetCurrentTimeMillis()
public static java.lang.String getLineSeparator()
public static java.lang.String getExceptionDescription(java.lang.Throwable e)
e
- throwable in questionpublic static void sleep(int sleepTimeInMilliseconds)
sleepTimeInMilliseconds
- time to sleep, in millisecondspublic static void copyBytes(byte[] src, int srcPos, byte[] dest, int destPos, int length)
src
- source arraysrcPos
- starting position in source arraydest
- destination arraydestPos
- position in destination arraylength
- number of elements to copypublic static void copyChars(char[] src, int srcPos, char[] dest, int destPos, int length)
src
- source arraysrcPos
- starting position in source arraydest
- destination arraydestPos
- position in destination arraylength
- number of elements to copypublic static void copyChars(java.lang.String src, int srcPos, char[] dest, int destPos, int length)
src
- source stringsrcPos
- starting position in source stringdest
- destination arraydestPos
- position in destination arraylength
- number of elements to copypublic static void useSystemProxy()
public static long doubleToRawLongBits(double value)
value
- input double valuepublic static double rawLongBitsToDouble(long value)
value
- input long valuepublic static <T> T defaultValue()
public static void arraycopy(java.lang.Object src, int srcPos, java.lang.Object dest, int destPos, int length)
length
elements of the Array src
starting at the offset srcPos
into the Array dest
at
the position destPos
.src
- the source array to copy the content.srcPos
- the starting index of the content in src
.dest
- * the destination array to copy the data into.destPos
- the starting index for the copied content in dest
.length
- the number of elements of the array1
content they have
to be copied.public static void exit(int code)
#runFinalizersOnExit(boolean)
has been previously invoked with a
true
argument, then all objects will be properly
garbage-collected and finalized first.code
- the return code.java.lang.SecurityException
- if the running thread has not enough permission to exit the
virtual machine.SecurityManager.checkExit(int)