| 
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.lang.Thread
net.sourceforge.obby4j.Protocol
public class Protocol
Provides encapsulation of low-level obby protocol messages and utility methods for converting protocol parameters into more meaningful Java types.
| Nested Class Summary | |
|---|---|
static class | 
Protocol.DocumentKeyword
A list of all subcommand keywords of the obby_document
 command known to this implementation of the obby protocol. | 
static class | 
Protocol.Keyword
A list of all protocol keywords known to this implementation of the obby protocol.  | 
| Nested classes/interfaces inherited from class java.lang.Thread | 
|---|
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler | 
| Field Summary | 
|---|
| Fields inherited from class java.lang.Thread | 
|---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY | 
| Constructor Summary | |
|---|---|
Protocol(java.net.InetAddress host,
         int port)
Creates a new Protocol instance to handle the low-level details of the obby protocol.  | 
|
| Method Summary | |
|---|---|
 void | 
addListener(ProtocolListener listener)
Register a listener to receive protocol commands.  | 
static java.lang.String | 
colorToHexString(java.awt.Color color)
Converts a color to an obby protocol color hex string.  | 
static java.awt.Color | 
hexStringToColor(java.lang.String hexColorString)
Converts an obby-compatoble hex string of a color to an Color instance.  | 
static int | 
hexStringToInt(java.lang.String obbyHexString)
Converts an obby hex string to an int.  | 
 void | 
login(User user)
Logs in to the server as the user of the Client instance.  | 
static java.lang.String | 
obbyDecode(java.lang.String message)
Decodes a message transferred via the obby protocol by unescaping backslashes, newline characters and colons.  | 
static java.lang.String | 
obbyEncode(java.lang.String message)
Encodes a message for transfer via the obby protocol by escaping backslashes, newline characters and colons.  | 
 void | 
removeListener(ProtocolListener listener)
Unregister a listener from receiving protocol commands.  | 
 void | 
run()
Handles incoming messages from the server.  | 
 void | 
sendMessage(java.lang.String message)
Sends a chat message to other users.  | 
 void | 
subscribe(Document document)
Subscribes this client to a document.  | 
 void | 
unsubscribe(Document document)
Unsubscribes this client from a document.  | 
| Methods inherited from class java.lang.Thread | 
|---|
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield | 
| Methods inherited from class java.lang.Object | 
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait | 
| Constructor Detail | 
|---|
public Protocol(java.net.InetAddress host,
                int port)
         throws java.io.IOException
host - port - 
java.io.IOException| Method Detail | 
|---|
public void addListener(ProtocolListener listener)
listener - the listener to registerpublic static java.lang.String colorToHexString(java.awt.Color color)
color - the color to convert
public static java.awt.Color hexStringToColor(java.lang.String hexColorString)
hexColorString - the color hex string to convert
public static int hexStringToInt(java.lang.String obbyHexString)
obbyHexString - the obby hex string of a number
public void login(User user)
           throws java.io.IOException,
                  Net6LoginException
user - 
java.io.IOException
Net6LoginException - if the login failed due to some protocol or obby problempublic static java.lang.String obbyDecode(java.lang.String message)
message - the message to decode
public static java.lang.String obbyEncode(java.lang.String message)
message - the message to encode
public void removeListener(ProtocolListener listener)
listener - the listener to unregisterpublic void run()
run in interface java.lang.Runnablerun in class java.lang.Thread
public void sendMessage(java.lang.String message)
                 throws java.io.IOException
message - the message to send
java.io.IOException
public void subscribe(Document document)
               throws java.io.IOException
document - the document to subscribe to
java.io.IOException
public void unsubscribe(Document document)
                 throws java.io.IOException
document - the document to unsubscribe from
java.io.IOException
  | 
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||