public class Utils
extends java.lang.Object
Constructor and Description |
---|
Utils() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
base64Encode(java.lang.String string,
java.nio.charset.Charset charset)
Encodes a string into Base64.
|
static java.lang.String |
getEventId()
Generates a random UUID for
each event.
|
static java.lang.String |
getTimestamp()
Returns the current System time
as a String.
|
static java.lang.String |
getTimezone()
Gets the default timezone of the server running
the library.
|
static int |
getTransactionId()
Returns a Transaction ID integer.
|
static long |
getUTF8Length(java.lang.String s)
Count the number of bytes a string will occupy when UTF-8 encoded
|
static boolean |
isValidUrl(java.lang.String url)
Validates a uri and checks that it is valid
before being used by the emitter.
|
static java.lang.String |
mapToJSONString(java.util.Map<java.lang.String,?> map)
Processes a Map into a JSON String or returns an empty
String if it fails
|
static java.lang.String |
mapToQueryString(java.util.Map<java.lang.String,?> map)
Builds a QueryString from a Map of Name-Value pairs.
|
static java.lang.String |
urlEncodeUTF8(java.lang.Object o)
Encodes an Object in UTF-8.
|
public static java.lang.String getTimestamp()
public static java.lang.String getEventId()
public static int getTransactionId()
public static boolean isValidUrl(java.lang.String url)
url
- the uri to validatepublic static java.lang.String getTimezone()
public static java.lang.String base64Encode(java.lang.String string, java.nio.charset.Charset charset)
string
- the string too encodecharset
- the charset used when base64 encoding stringpublic static java.lang.String mapToJSONString(java.util.Map<java.lang.String,?> map)
map
- the map to process into a JSON Stringpublic static java.lang.String mapToQueryString(java.util.Map<java.lang.String,?> map)
map
- The map to convertpublic static java.lang.String urlEncodeUTF8(java.lang.Object o)
o
- The object to encodepublic static long getUTF8Length(java.lang.String s)
s
- the String to process