public class JavaHelper extends Object
Constructor and Description |
---|
JavaHelper() |
Modifier and Type | Method and Description |
---|---|
static byte[] |
addArrayElements(byte[] toArray,
byte[] fromArray)
Adds the elements of the fromArray to the toArray.
|
static String[] |
addArrayElements(String[] toArray,
String[] fromArray)
Adds the elements of the fromArray to the toArray.
|
static void |
cleanUpDir(String dirToClean,
int olderThanTimeMillis)
deletes all files in the specified directory which are older than olderThanTimeMillis.
|
static void |
cleanUpDir(String dirToClean,
int olderThanTimeMillis,
String postFix)
deletes all files in the specified directory which are older than olderThanTimeMillis and have the
defined postFix.
|
static File |
genFile(String parentPath,
String midPart,
String postfix)
Generates a file name with the specified parent path, midPart and postFix.
|
static File |
genRndFile(String parentPath,
String midPart,
String postfix)
Generates a random file name with the specified parent path, midPart and postFix.
|
static String |
normalize(String toNormalize) |
static String[] |
toStringArray(Object[] oArray)
transforms the oArray to a String[]
|
static Color |
transformToColor(String hexString)
Transforms a hexadecimal to a Color object.
|
public static String[] toStringArray(Object[] oArray)
oArray
- the Object[] that should be converted to String[] via Object[n].toString()public static byte[] addArrayElements(byte[] toArray, byte[] fromArray)
toArray
- the array to add tofromArray
- the array to addtoArray
and than the elements
of fromArray
.public static String[] addArrayElements(String[] toArray, String[] fromArray)
toArray
- the array to add tofromArray
- the array to addtoArray
and than the elements
of fromArray
.public static Color transformToColor(String hexString)
hexString
- 7 character hex-string; something like "#FF6600"public static File genRndFile(String parentPath, String midPart, String postfix) throws IOException
parentPath
- the directory pathmidPart
- this part will be used as filename part after a generated random partpostfix
- a postfix that will be added after midPart using "."IOException
- when the directory for the file could not be generatedgenFile(java.lang.String, java.lang.String, java.lang.String)
,
System.currentTimeMillis()
public static File genFile(String parentPath, String midPart, String postfix) throws IOException
parentPath
- the directory pathmidPart
- this part will be used as filenamepostfix
- a postfix that will be added after midPart using "."IOException
- when the directory for the file could not be generated.public static String normalize(String toNormalize)
toNormalize
- String to normalize.public static void cleanUpDir(String dirToClean, int olderThanTimeMillis) throws IOException
dirToClean
- the directory to cleanolderThanTimeMillis
- the timestamp that will be compared with File.lastModified()
of each file in the given folder. Older files will be deleted.IOException
- when a file in the given directory could not be deleted.public static void cleanUpDir(String dirToClean, int olderThanTimeMillis, String postFix) throws IOException
dirToClean
- the directory to cleanolderThanTimeMillis
- the timestamp that will be compared with File.lastModified()
of each file in the given folder. Older files will be deleted.postFix
- Only files ending with postfix
will be deletedIOException
- when a file in the given directory could not be deleted.Copyright © 2012–2017 52North Initiative for Geospatial Open Source Software GmbH. All rights reserved.