server
Class Common

java.lang.Object
  extended by server.Common

public class Common
extends java.lang.Object

some basic methods that can be useful for both server and client

Author:
Henry

Constructor Summary
Common()
           
 
Method Summary
static java.lang.String decodeStringPacket(byte[] buf)
          extract the string from the other noise in the packet
static byte[] encodeStringPacket(java.lang.String text)
          create a byte array containing the length of the string and the string
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Common

public Common()
Method Detail

encodeStringPacket

public static byte[] encodeStringPacket(java.lang.String text)
create a byte array containing the length of the string and the string

Parameters:
text - the string to be sent iun the packet
Returns:
the byte array to be used for the packet

decodeStringPacket

public static java.lang.String decodeStringPacket(byte[] buf)
extract the string from the other noise in the packet

Parameters:
buf - the byte array from the packet
Returns:
the string that was contained in the packet