public abstract class ClientSharedUtils extends Object
| Modifier and Type | Field and Description |
|---|---|
static TimeZone |
currentTimeZone
The cached timezone of this VM.
|
static long |
currentTimeZoneOffset
The cached timezone offset not including daylight savings.
|
static String |
currentTZShortName
short display name of current timezone in current locale
|
static String |
currentTZShortNameDST
short display name of current timezone+daylight in current locale
|
static char[] |
HEX_DIGITS |
static char[] |
HEX_DIGITS_UCASE |
static String |
lineSeparator
the system line separator
|
static String |
LOGGER_NAME
The name of java.util.logging.Logger for GemFireXD.
|
static long |
MAG_MASK |
static String |
USE_LINK_LOCAL_ADDRESSES_PROPERTY
Optional system property to enable GemFire usage of link-local addresses
|
static boolean |
USE_THRIFT_AS_DEFAULT
True if using Thrift as default network server and client, false if using
DRDA (default).
|
static String |
USE_THRIFT_AS_DEFAULT_PROP
System property (with "gemfirexd." prefix) to specify that Thrift is to be
used as the default for default
jdbc:gemfirexd:// URL |
| Modifier and Type | Method and Description |
|---|---|
static void |
clear() |
static boolean |
equalBuffers(byte[] bytes,
ByteBuffer buffer) |
static boolean |
equalBuffers(ByteBuffer connToken,
ByteBuffer otherId) |
static void |
formatDate(long time,
int tzOffset,
StringBuilder sb)
Adapted from Derby's CheapDateFormatter to make use of given calendar and
make it more efficient using StringBuilder.
|
static void |
formatDate(long currentTimeInMillis,
StringBuilder sb) |
static byte[] |
fromHexString(String s,
int offset,
int length)
Convert a hexidecimal string generated by toHexString() back into a byte
array.
|
static int[] |
getBigIntInternalMagnitude(BigInteger val)
Returns the internal int[] magnitude from given BigInteger, if possble,
else returns null.
|
static int |
getBigIntMagnitudeSizeInBytes(int[] magnitude) |
static InetAddress |
getCachedLocalHost() |
static JdkHelper |
getJdkHelper() |
static InetAddress |
getLocalHost()
All GemFire code should use this method instead of
InetAddress.getLocalHost().
|
static Logger |
getLogger() |
static Set<InetAddress> |
getMyAddresses(boolean includeLocal)
returns a set of the non-loopback InetAddresses for this machine
|
static void |
getStackTrace(Throwable t,
StringBuilder sb,
String lineSep)
Append the backtrace of given exception to provided
StringBuilder. |
static Object[] |
getZeroLenObjectArray() |
static void |
initLog4J(String logFile,
Level level) |
static void |
initLogger(String loggerName,
String logFile,
boolean initLog4j,
Level level,
Handler handler) |
static RuntimeException |
newRuntimeException(String message,
Throwable cause) |
static int |
numBytesWithoutZeros(long value)
Get the number of bytes occupied in the given unsigned integer value.
|
static void |
objectString(Object obj,
StringBuilder sb)
Get proper string for an object including arrays.
|
static void |
objectStringNonRecursive(Object obj,
StringBuilder sb)
Get proper string for an an object including arrays with upto one dimension
of arrays.
|
static boolean |
preferIPv6Addresses()
All classes should use this instead of relying on the JRE system property
|
static String |
reverseDNS(InetAddress addr)
This method uses JNDI to look up an address in DNS and return its name.
|
static void |
setCommonRuntimeException(CommonRunTimeException e) |
static void |
setKeepAliveOptions(Socket sock,
InputStream sockStream,
int keepIdle,
int keepInterval,
int keepCount)
Enable TCP KeepAlive settings for the socket.
|
static void |
setLogger(Logger log) |
static char[] |
toHexChars(byte[] data,
int offset,
int length)
Convert a byte array to a char[] with a hexidecimal format.
|
static String |
toHexString(byte[] data,
int offset,
int length)
Convert a byte array to a String with a hexidecimal format.
|
static String |
toHexString(ByteBuffer buffer)
Convert a ByteBuffer to a String with a hexidecimal format.
|
static void |
toHexString(ByteBuffer buffer,
StringBuilder sb)
Convert a ByteBuffer to a string appending to given
StringBuilder
with a hexidecimal format. |
static String |
toHexStringUpperCase(byte[] data,
int offset,
int length)
Convert a byte array to a String with upper case hexidecimal format.
|
static boolean |
wrapsFullArray(ByteBuffer byteBuffer) |
public static final String LOGGER_NAME
public static final String USE_LINK_LOCAL_ADDRESSES_PROPERTY
public static final String USE_THRIFT_AS_DEFAULT_PROP
jdbc:gemfirexd:// URLpublic static final boolean USE_THRIFT_AS_DEFAULT
public static final String lineSeparator
public static char[] HEX_DIGITS
public static char[] HEX_DIGITS_UCASE
public static final TimeZone currentTimeZone
public static final long currentTimeZoneOffset
public static final String currentTZShortName
public static final String currentTZShortNameDST
public static final long MAG_MASK
public static final JdkHelper getJdkHelper()
public static InetAddress getLocalHost() throws UnknownHostException
UnknownHostExceptionpublic static InetAddress getCachedLocalHost()
public static boolean preferIPv6Addresses()
public static String reverseDNS(InetAddress addr)
addr - the address to be looked uppublic static Set<InetAddress> getMyAddresses(boolean includeLocal) throws SocketException
SocketExceptionpublic static void setKeepAliveOptions(Socket sock, InputStream sockStream, int keepIdle, int keepInterval, int keepCount) throws SocketException
sock - the underlying Java Socket to set the keep-alivesockStream - the InputStream of the socket (can be null); if non-null then it
is used to determine the underlying socket kernel handle else if
null then reflection on the socket itself is usedkeepIdle - keep-alive time between two transmissions on socket in idle
condition (in seconds)keepInterval - keep-alive duration between successive transmissions on socket if
no reply to packet sent after idle timeout (in seconds)keepCount - number of retransmissions to be sent before declaring the other
end to be deadSocketException - if the base keep-alive cannot be enabled on the socketpublic static void getStackTrace(Throwable t, StringBuilder sb, String lineSep)
StringBuilder.t - the exception whose backtrace is requiredsb - the StringBuilder to which the stack trace is to be
appendedlineSep - the line separator to use, or null to use the default from system
"line.separator" propertypublic static Object[] getZeroLenObjectArray()
public static void formatDate(long currentTimeInMillis,
StringBuilder sb)
public static void formatDate(long time,
int tzOffset,
StringBuilder sb)
time - The current time in milliseconds since Jan. 1, 1970tzOffset - The offset of TimeZone including DST.sb - Append the date formatted as yyyy/mm/dd hh:mm:ss.ddd to the
StringBuilder.public static String toHexString(byte[] data, int offset, int length)
b & 0xf0),
the second character represents the low nibble (b & 0x0f). data[offset] is represented by the first two
characters in the returned String.data - byte arrayoffset - starting byte (zero based) to convert.length - number of bytes to convert.public static String toHexStringUpperCase(byte[] data, int offset, int length)
b & 0xf0),
the second character represents the low nibble (b & 0x0f). data[offset] is represented by the first two
characters in the returned String.data - byte arrayoffset - starting byte (zero based) to convert.length - number of bytes to convert.public static char[] toHexChars(byte[] data,
int offset,
int length)
b & 0xf0),
the second character represents the low nibble (b & 0x0f). data[offset] is represented by the first two
characters in the returned char[].data - byte arrayoffset - starting byte (zero based) to convert.length - number of bytes to convert.public static String toHexString(ByteBuffer buffer)
b & 0xf0),
the second character represents the low nibble (b & 0x0f). data[offset] is represented by the first two
characters in the returned String.buffer - the ByteBuffer to convertpublic static boolean wrapsFullArray(ByteBuffer byteBuffer)
public static void toHexString(ByteBuffer buffer, StringBuilder sb)
StringBuilder
with a hexidecimal format. The string may be converted back to a byte array
using fromHexString. b & 0xf0),
the second character represents the low nibble (b & 0x0f). data[offset] is represented by the first two
characters in the returned string.buffer - the ByteBuffer to convertsb - the StringBuilder to which conversion result is appendedpublic static byte[] fromHexString(String s, int offset, int length)
s - String to convertoffset - starting character (zero based) to convertlength - number of characters to convertIllegalArgumentException - if the given string is not a hex-encoded onepublic static void setCommonRuntimeException(CommonRunTimeException e)
public static RuntimeException newRuntimeException(String message, Throwable cause)
public static void initLog4J(String logFile, Level level) throws IOException
IOExceptionpublic static void initLogger(String loggerName, String logFile, boolean initLog4j, Level level, Handler handler)
public static void setLogger(Logger log)
public static Logger getLogger()
public static int[] getBigIntInternalMagnitude(BigInteger val)
public static int getBigIntMagnitudeSizeInBytes(int[] magnitude)
public static final int numBytesWithoutZeros(long value)
public static void clear()
public static void objectStringNonRecursive(Object obj, StringBuilder sb)
public static void objectString(Object obj, StringBuilder sb)
public static boolean equalBuffers(ByteBuffer connToken, ByteBuffer otherId)
public static boolean equalBuffers(byte[] bytes,
ByteBuffer buffer)
Copyright © 2010-2015 Pivotal Software, Inc. All rights reserved.