|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectinf1010.pusle.chat.ChatUtilities
public class ChatUtilities
A utility class containing constants for the chat system.
Field Summary | |
---|---|
static java.nio.charset.Charset |
charset
The character set used by the chat system (UTF-8). |
static int |
DATA_INDEX
Packet indices. |
static int |
DEFAULT_PORT
The default port number used by the chat programs. |
static byte |
DISCONNECT
Packet types. |
static int |
HEADER_LENGTH
Number of bytes in a packet header. |
static byte |
INVALID_PACKET
Packet types. |
static byte |
INVALID_USERNAME
Packet types. |
static int |
LENGTH_INDEX
Packet indices. |
static byte |
LOGIN
Packet types. |
static int |
MAX_LENGTH
The maximum length of data sent in a packet. |
static byte |
MESSAGE
Packet types. |
static byte |
MESSAGE_FROM
Packet types. |
static byte |
NEW_USER
Packet types. |
static int |
TYPE_INDEX
Packet indices. |
static byte |
USER_LEFT
Packet types. |
static byte |
USER_LIST
Packet types. |
static byte |
WELCOME
Packet types. |
Constructor Summary | |
---|---|
ChatUtilities()
|
Method Summary | |
---|---|
static Message |
recvMessage(java.io.InputStream in)
Receives a message from an input stream. |
static boolean |
sendMessage(byte type,
java.lang.String data,
java.io.OutputStream out)
Sends data on an output stream. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int DEFAULT_PORT
public static final int HEADER_LENGTH
public static final int MAX_LENGTH
public static final java.nio.charset.Charset charset
public static final int TYPE_INDEX
public static final int LENGTH_INDEX
public static final int DATA_INDEX
public static final byte LOGIN
public static final byte WELCOME
public static final byte USER_LIST
public static final byte NEW_USER
public static final byte USER_LEFT
public static final byte DISCONNECT
public static final byte MESSAGE_FROM
public static final byte MESSAGE
public static final byte INVALID_USERNAME
public static final byte INVALID_PACKET
Constructor Detail |
---|
public ChatUtilities()
Method Detail |
---|
public static boolean sendMessage(byte type, java.lang.String data, java.io.OutputStream out) throws java.io.IOException
type
- the type of message to send to the server.data
- the data to send with the message.out
- the output stream to send data to.
java.io.IOException
- if anything goes wrong with sending the data.public static Message recvMessage(java.io.InputStream in) throws java.io.IOException
in
- the input stream to receive the message from.
java.io.IOException
- if anything goes wrong with receiving the data.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |