net.jetrix.protocols
Class ConsoleProtocol

java.lang.Object
  extended by net.jetrix.protocols.ConsoleProtocol
All Implemented Interfaces:
Protocol

public class ConsoleProtocol
extends Object
implements Protocol

Protocol to communicate with a console client

Version:
$Revision: 440 $, $Date: 2004-10-27 02:15:39 +0200 (mer., 27 oct. 2004) $
Author:
Emmanuel Bourg

Constructor Summary
ConsoleProtocol()
           
 
Method Summary
 String applyStyle(String text)
          Transform the style tags (<blue>, <u>, etc...) contained in the specified string into the style codes of this protocol.
 char getEOL()
          Return the end of line character used by this protocol.
 Message getMessage(String line)
          Parse the specified string and return the corresponding server message for this protocol.
 String getName()
          Return the name of this protocol
 Map<String,String> getStyles()
           
 String toString()
           
 String translate(Message m, Locale locale)
          Translate the specified message into a string that will be sent to a client using this protocol.
 String translate(TextMessage m, Locale locale)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ConsoleProtocol

public ConsoleProtocol()
Method Detail

getName

public String getName()
Return the name of this protocol

Specified by:
getName in interface Protocol
Returns:
the name of this protocol

getMessage

public Message getMessage(String line)
Parse the specified string and return the corresponding server message for this protocol.

Specified by:
getMessage in interface Protocol
Parameters:
line - the client message to parse
Returns:
the Message equivalent of the specified String or null if the protocol cannot understand the message.

translate

public String translate(Message m,
                        Locale locale)
Translate the specified message into a string that will be sent to a client using this protocol.

Specified by:
translate in interface Protocol
Parameters:
m - the message to translate
locale - the locale used for internationalized text messages
Returns:
the String equivalent in this protocol for the specified Message or null if it can't be translated.

translate

public String translate(TextMessage m,
                        Locale locale)

getStyles

public Map<String,String> getStyles()

applyStyle

public String applyStyle(String text)
Description copied from interface: Protocol
Transform the style tags (<blue>, <u>, etc...) contained in the specified string into the style codes of this protocol.

Specified by:
applyStyle in interface Protocol
Parameters:
text - the string to transform
Returns:
the stylized representation of the specified string for this protocol.

getEOL

public char getEOL()
Description copied from interface: Protocol
Return the end of line character used by this protocol.

Specified by:
getEOL in interface Protocol

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2001-2008 Emmanuel Bourg. All Rights Reserved.