public class Utils extends Object
Modifier and Type | Field and Description |
---|---|
static String |
UNSAFE_CHARACTERS
Regular expression for unsafe characters.
|
static String |
WHITE_SPACE
White space characters.
|
Modifier and Type | Method and Description |
---|---|
static String |
ensureCanonicalName(String fileName)
Ensures that the given file name is in a canonical form by replacing unsafe characters with underscores.
|
static String |
humanReadableByteCount(long bytes)
Converts a bytes number to a human-readable string representation.
|
static boolean |
isStringEmpty(String s)
Checks if the given string is empty or null.
|
static byte[] |
subArray(byte[] source,
int length)
Creates a sub-array from the given source array up to the specified length.
|
static byte[] |
subArray(byte[] source,
int offset,
int length)
Creates a sub-array from the given source array starting at the specified offset and up to the specified length.
|
static String |
systemProperties2String()
Converts system properties to a string representation.
|
static String |
trimWhiteSpace(String value)
Trims leading and trailing white space from the given string.
|
static void |
waitForEnter()
Waits for the user to press Enter.
|
static void |
waitForEnter(String message)
Waits for the user to press Enter and displays a custom message.
|
static void |
waitForEnterToTerminateApp()
Waits for the user to press Enter and displays a termination message.
|
public static final String UNSAFE_CHARACTERS
public static final String WHITE_SPACE
public static byte[] subArray(byte[] source, int length)
source
- The source byte array.length
- The length of the sub-array.public static byte[] subArray(byte[] source, int offset, int length)
source
- The source byte array.offset
- The starting index of the sub-array.length
- The length of the sub-array.public static String systemProperties2String()
public static void waitForEnter()
public static void waitForEnterToTerminateApp()
public static void waitForEnter(String message)
message
- The message to display before waiting for Enter.public static boolean isStringEmpty(String s)
s
- The string to check.public static String trimWhiteSpace(String value)
value
- The string to trim.public static String humanReadableByteCount(long bytes)
bytes
- The number of bytes to convert.public static String ensureCanonicalName(String fileName)
fileName
- The file name to be converted.Copyright © 2005–2025 Onix Solutions. All rights reserved.