Package javaforce.jbus
Class JBusClient
java.lang.Object
java.lang.Thread
javaforce.jbus.JBusClient
- All Implemented Interfaces:
Runnable
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Thread
Thread.Builder, Thread.State, Thread.UncaughtExceptionHandler -
Field Summary
FieldsFields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanInvoke function in all client matching package.booleanInvoke function in another client using condensed package.function.args format.booleanInvoke function in another client.voidclose()Closes connection to server.static byte[]decodeByteArray(String str) Decode String as byte[]static StringdecodeString(String in) Decode a string if it contains quotes, etc.static StringencodeByteArray(byte[] ba) Encode byte[] as a String.static StringencodeString(String in) Encode a string if it contains quotes, etc.static StringQuotes a string.booleanready()Returns if client is connected to server and ready.voidrun()voidsetDebug(boolean state) Enable logging exceptions to console.voidsetDispatch(Dispatch dispatch) Setup alternative message dispatch.voidsetPort(int port) Set server port.Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, isVirtual, join, join, join, join, ofPlatform, ofVirtual, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, sleep, start, startVirtualThread, stop, suspend, threadId, toString, yield
-
Field Details
-
pack
-
-
Constructor Details
-
JBusClient
Creates new client.- Parameters:
pack- = client name in dot notationobj- = object with methods to invoke for RPC calls
-
-
Method Details
-
setDispatch
Setup alternative message dispatch. -
setDebug
public void setDebug(boolean state) Enable logging exceptions to console. -
setPort
public void setPort(int port) Set server port. Must be called before start(). -
run
public void run() -
call
Invoke function in another client.- Parameters:
pack- = other clients name (package)func- = method to invokeargs- = comma list of arguments to pass ("strings" or integers only)
-
call
Invoke function in another client using condensed package.function.args format.- Parameters:
pfa- = package.function(args) There should be no quote around args (just around strings if there are any)
-
broadcast
Invoke function in all client matching package.- Parameters:
pack- = other clients name (package) if client.package.startsWith(pack) it will receive messagefunc- = method to invokeargs- = comma list of arguments to pass ("strings" or integers only)
-
ready
public boolean ready()Returns if client is connected to server and ready. -
close
public void close()Closes connection to server. -
quote
Quotes a string. -
encodeString
Encode a string if it contains quotes, etc. -
decodeString
Decode a string if it contains quotes, etc. -
encodeByteArray
Encode byte[] as a String. -
decodeByteArray
Decode String as byte[]
-