public final class SysUtil
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
SysUtil.Thunk<T>
A Thunk
|
Constructor and Description |
---|
SysUtil() |
Modifier and Type | Method and Description |
---|---|
static <T> java.lang.Iterable<T> |
chain(java.lang.Iterable<T>... iters)
Returns an iterable that iterates over the elements of the iterables passed
in.
|
static java.lang.Object |
deserialize(byte[] bytes)
Turns an array of bytes into an object using Java serialization.
|
static java.lang.Class<? extends Object._Impl> |
getImplClass(java.lang.Class<? extends Object> clazz)
Returns the _Impl class for the given Fabric class.
|
static java.lang.String |
getNodeCN(java.lang.String nodeName,
long principalOnum) |
static java.lang.String |
getNodeName(java.lang.String nodeCN) |
static long |
getPrincipalOnum(java.lang.String nodeCN) |
static byte[] |
hashFClass(ClassRef.FabricClassRef fcr)
Returns the class hash for the Fabric class referred by the given
FabricClassRef.
|
static byte[] |
hashPlatformClass(java.lang.Class<?> c)
Generates a cryptographically secure hash of a platform class.
|
static java.net.URL |
locateClass(java.lang.String className) |
static byte[] |
serialize(java.lang.Object obj)
Turns an object into an array of bytes using Java serialization.
|
public static java.lang.String getNodeCN(java.lang.String nodeName, long principalOnum)
public static long getPrincipalOnum(java.lang.String nodeCN)
public static java.lang.String getNodeName(java.lang.String nodeCN)
public static byte[] hashPlatformClass(java.lang.Class<?> c) throws java.io.IOException
c
- the Class object for a class that is not stored in Fabric. If it's
a Fabric class, this is the interface corresponding to the Fabric
type, and not the _Proxy or _Impl classes.java.io.IOException
public static byte[] hashFClass(ClassRef.FabricClassRef fcr)
public static java.lang.Class<? extends Object._Impl> getImplClass(java.lang.Class<? extends Object> clazz)
clazz
- the Class object for a Fabric class. This is the interface
corresponding to the Fabric type, and not the _Proxy or _Impl
classes.clazz
. If no _Impl class is
found (i.e., clazz represents a Fabric interface),
null
is returned.public static java.net.URL locateClass(java.lang.String className) throws java.lang.ClassNotFoundException
java.lang.ClassNotFoundException
@SafeVarargs public static <T> java.lang.Iterable<T> chain(java.lang.Iterable<T>... iters)
Returns an iterable that iterates over the elements of the iterables passed in. The common use is:
for (T o : Utils.chain(a, b, c)) o.f()which will call f() on each element of a, then each element of b, then each element of c.
This is intended to be more efficient and easier than creating a new collection containing the contents.
T
- the types of the elements of the iterablesiters
- the iterables to chainpublic static byte[] serialize(java.lang.Object obj) throws java.io.IOException
java.io.IOException
public static java.lang.Object deserialize(byte[] bytes) throws java.io.IOException, java.lang.ClassNotFoundException
java.io.IOException
java.lang.ClassNotFoundException