public interface AQUtil
A singleton instance of this class is mapped to a global name aqua.util.
Modifier and Type | Method and Description |
---|---|
String |
formatByteSize(double bytes,
String format,
int decimalPos)
Formats size of files into something more readable.
|
String |
formatTimeInterval(long interval)
Formats time interval into human-readable form.
|
byte[] |
hexDecode(String data)
Converts an array of characters representing hexidecimal values into an
array of bytes of those same values.
|
String |
hexEncode(byte[] data)
Converts an array of bytes into an array of characters representing the hexidecimal values of each byte in order.
|
String |
htmlDecode(String text)
Unescapes a string containing HTML entity escapes to a string containing the actual Unicode
characters corresponding to the escapes.
|
String |
htmlEncode(String text)
Escapes the characters in a String using HTML entities.
|
boolean |
isBlank(Object text)
Returns true if argument text is empty or contains only whitespace symbols.
|
Object |
newJavaArray(String type,
int length)
Creates a new java array with the specified component type and length.
|
void |
sleep(int ms)
Causes script to sleep for a specified number of milliseconds.
|
String |
sqlEncode(String string)
Escapes single quote characters in a string to make it safe for inclusion into a SQL query.
|
String |
urlEncode(String string)
Translates a string into
x-www-form-urlencoded
format. |
void sleep(int ms) throws Exception
ms
- Delay in milliseconds.Exception
- On errorboolean isBlank(Object text)
text
- A text string or AQOpaqueObject
.String formatTimeInterval(long interval)
interval
- Time interval in milliseconds.String formatByteSize(double bytes, String format, int decimalPos) throws Exception
bytes
- The value to be formatted.format
- Valid string values are "B", "KB", "MB", "GB", "TB"decimalPos
- Sets the maximum number of digits allowed in the fraction portion of a number.Exception
- on errorString urlEncode(String string)
x-www-form-urlencoded
format. This method uses UTF-8 encoding to obtain the bytes for unsafe characters.string
- A string to be encoded.String sqlEncode(String string)
string
- A string to be encoded.String htmlEncode(String text)
text
- Text string.String htmlDecode(String text)
text
- Encoded text string.Object newJavaArray(String type, int length) throws Exception
aqua.util.newJavaArray('java.lang.String', 100);
aqua.util.newJavaArray('byte', 0);
type
- Fully qualified name of a Class
representing the component type of the new array.length
- The length of the new array.Exception
- On errorString hexEncode(byte[] data)
data
- a byte[] to convert to Hex characters.byte[] hexDecode(String data) throws Exception
data
- An array of characters containing hexidecimal digitsException
- On Error
Copyright © 2017 AquaFold, Inc. All Rights Reserved. Use is subject to license terms.