diff options
Diffstat (limited to 'dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/util/Util.java')
-rw-r--r-- | dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/util/Util.java | 47 |
1 files changed, 0 insertions, 47 deletions
diff --git a/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/util/Util.java b/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/util/Util.java deleted file mode 100644 index 8e6950e8..00000000 --- a/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/util/Util.java +++ /dev/null @@ -1,47 +0,0 @@ -package org.openslx.bwlp.sat.util; - -import java.util.regex.Pattern; - -public class Util { - - /** - * Try to close everything passed to this method. Never throw an exception - * if it fails, just silently continue. - * - * @param item One or more objects that are AutoCloseable - */ - public static void safeClose(AutoCloseable... item) { - if (item == null) - return; - for (AutoCloseable c : item) { - if (c == null) - continue; - try { - c.close(); - } catch (Exception e) { - } - } - } - - private static Pattern nonprintableExp = Pattern.compile("[\\p{C}\\p{Zl}\\p{Zp}]"); - private static Pattern nonSpaceExp = Pattern.compile("[^\\p{C}\\p{Z}]"); - - /** - * Whether the given string contains only printable characters. - * - * @param string {@link String} to check - * @return - */ - public static boolean isPrintable(String string) { - return !nonprintableExp.matcher(string).find(); - } - - public static boolean isEmptyString(String string) { - return string == null || !nonSpaceExp.matcher(string).find(); - } - - public static long unixTime() { - return System.currentTimeMillis() / 1000; - } - -} |