|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object CTL.RUtil
public class RUtil
Static utility functions which did not fit anywhere else
Field Summary | |
---|---|
private static int |
halt
Keeps track of recursive calls to avoid infinite loops |
static java.lang.reflect.Method |
serialrd
Method objects for serialRead() and serialWrite() |
static java.lang.reflect.Method |
serialrd2
Method objects for serialRead() and serialWrite() |
static java.lang.reflect.Method |
serialwr
Method objects for serialRead() and serialWrite() |
Constructor Summary | |
---|---|
RUtil()
|
Method Summary | |
---|---|
private static java.lang.String |
__stackTrace(java.lang.StackTraceElement[] trace)
Stacktrace printer helper function |
private static java.lang.String |
__stackTrace(java.lang.StackTraceElement[] trace,
int len)
Stacktrace printer helper function |
static java.lang.Class |
classToRI(java.lang.Class klas)
Find the remote interface class for an implementation class |
static java.lang.String |
converter(java.lang.String type,
java.lang.String convert_me)
Retrieve a conversion code snippet for a certain type |
static void |
except(java.lang.Exception e)
Properly decode and display an exception |
static java.lang.String |
getBase(java.lang.String name)
Get the implementation class of some CI/RI |
static char |
getCID(java.lang.reflect.Constructor construct)
Get the FID for a certain constructor |
static char |
getFID(java.lang.reflect.Method method)
Get the FID for a certain method |
static java.lang.reflect.Method |
getReader(java.lang.String type)
Returns a reader function for the specified type |
static java.lang.reflect.Method |
getReceiver(java.lang.String type)
Returns a receiver function for the specified type |
static java.lang.reflect.Method |
getWriter(java.lang.String type)
Returns a writer function for the specified type |
static void |
main(java.lang.String[] args)
|
static int |
objSize(java.lang.Object obj)
Calculate the serialized size of an object |
static int |
optInt(gnu.getopt.Getopt g)
Extract an integer from a CLI option |
static PeerID |
optPeerID(gnu.getopt.Getopt g)
Extract a PeerID from a CLI option |
static PeerID |
optPeerID(java.lang.String arg)
Extract a PeerID from a CLI option |
static java.lang.String |
optString(gnu.getopt.Getopt g)
Extract a String from a CLI option |
static java.lang.String |
reader2str(java.lang.String reader)
Convert a reader function to string |
static java.lang.String |
stackTrace()
Pretty print stacktrace of the current thread |
static java.lang.String |
stackTrace(java.lang.Exception e)
Print the backtrace of an exception |
static int |
tryInt(java.lang.String str)
Fault-tolerant string to integer conversion |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static java.lang.reflect.Method serialrd
public static java.lang.reflect.Method serialrd2
public static java.lang.reflect.Method serialwr
private static int halt
Constructor Detail |
---|
public RUtil()
Method Detail |
---|
public static java.lang.String stackTrace(java.lang.Exception e)
e
- Exception
private static java.lang.String __stackTrace(java.lang.StackTraceElement[] trace)
trace
- Stacktrace element
private static java.lang.String __stackTrace(java.lang.StackTraceElement[] trace, int len)
trace
- Stacktrace elementlen
- Length
public static java.lang.String stackTrace()
public static void except(java.lang.Exception e)
e
- Exceptionpublic static char getFID(java.lang.reflect.Method method)
method
- Method
public static char getCID(java.lang.reflect.Constructor construct)
construct
- Constructor
public static java.lang.reflect.Method getReader(java.lang.String type)
type
- Type to read
public static java.lang.reflect.Method getWriter(java.lang.String type)
type
- Type to write
public static java.lang.reflect.Method getReceiver(java.lang.String type)
type
- Type to receive
public static java.lang.String reader2str(java.lang.String reader)
reader
- Reader function
public static java.lang.Class classToRI(java.lang.Class klas) throws java.lang.ClassNotFoundException
klas
- Implementation class
java.lang.ClassNotFoundException
public static int objSize(java.lang.Object obj) throws java.io.IOException, java.lang.IllegalAccessException, java.lang.reflect.InvocationTargetException, CTLException
obj
- Object
java.io.IOException
java.lang.IllegalAccessException
java.lang.reflect.InvocationTargetException
CTLException
public static java.lang.String converter(java.lang.String type, java.lang.String convert_me)
type
- Typeconvert_me
- Name of the variable to convert
public static int tryInt(java.lang.String str)
str
- String to convert
public static PeerID optPeerID(java.lang.String arg)
arg
- String
public static PeerID optPeerID(gnu.getopt.Getopt g)
g
- Getopt parser object
public static int optInt(gnu.getopt.Getopt g)
g
- Getopt parser object
public static java.lang.String optString(gnu.getopt.Getopt g)
g
- Getopt parser object
public static java.lang.String getBase(java.lang.String name)
name
- CI/RI name
public static void main(java.lang.String[] args)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |