|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnetworking.protocol.Message
public class Message
Message - this class represents a message, which can be sent and received through IO streams
Field Summary | |
---|---|
static int |
ACCEPT
ACCEPT message type constant - server accepts client connection |
static int |
ACCEPT_FILE
ACCEPT_FILE message type constant - new file was accepted by some client |
static int |
ACCEPT_FILE_SENT
ACCEPT_FILE_SENT message type constant - new file was accepted by client sent by clients |
static int |
BROADCAST_SENT
BROADCAST_SENT message type constant - broadcast message sent |
static int |
BYE
BYE message type constant - server or client has disconnected |
static int |
CLIENT_LIST_CHANGED
CLIENT_LIST_CHANGED message type constant - new client has connected or a client has disconnected |
static int |
DEBAR
DEBAR message type constant - leader debars enlisted clients sent to clients |
static int |
DEBAR_SENT
DEBAR_SENT message type constant - leader debars enlisted clients sent from leader |
static int |
DISCONNECT
DISCONNECT message type constant - master asks client or server to disconnect |
static int |
FILE_DOWNLOAD_ERROR
FILE_DOWNLOAD_ERROR message type constant - FileDownloadServer informs client about error |
static int |
FILE_DOWNLOAD_OK
FILE_DOWNLOAD_OK message type constant - client has succefully completed file download |
static int |
FILE_DOWNLOAD_START
FILE_DOWNLOAD_START message type constant - FileDownloadServer informs client about starting the file transfer |
static int |
FILE_RECV
FILE_RECV message type constant - client want to recieve file from server |
static int |
FILE_SENT
FILE_SENT message type constant - client want to send file to a list of clients |
static int |
FILE_UPLOAD_OK
FILE_UPLOAD_OK message type constant - client has succefully completed file upload |
static int |
FILE_WAIT
FILE_WAIT message type constant - FileDownloadServer waits while source file is being uploaded |
static int |
HI_FILE
HI_FILE message type constant - client request for connection with FileServer |
static int |
HI_TALK
HI message type constant - client request for connection |
private long |
m_code
Code part of the message, the meaning of code depends on message's type |
private java.util.List |
m_list
List of concerned objects or null |
private long |
m_long
Long value part of the message, the meaning depends on message's type |
private java.lang.String |
m_str
String part of the message, the meaning of string depends on message's type. |
private int |
m_type
Type of the message |
static int |
MESSAGE_SENT
NEW_MESSAGE_SENT message type constant - a client sends new message to the list of recipients |
static int |
NEW_FILE
NEW_FILE message type constant - new file is sent by somebody sent to clients |
static int |
NEW_MESSAGE
NEW_MESSAGE message type constant - new message has arrived from other client |
static int |
NONE
NONE message type constant - no contents |
static int |
REJECT
REJECT message type constant - server rejects client connection |
static int |
REJECT_FILE
REJECT_FILE message type constant - new file was rejected by all clients |
static int |
REJECT_FILE_SENT
REJECT_FILE_SENT message type constant - new file was rejected by client sent by clients |
static int |
TIMEOUT
TIMEOUT message type constant - server or client time-out has elapsed |
Constructor Summary | |
---|---|
Message(int type)
Construct new Message object |
|
Message(int type,
Client client,
java.lang.String str)
Construct new Message object |
|
Message(int type,
Client client,
java.lang.String str,
long code)
Construct new Message object |
|
Message(int type,
java.util.List list,
java.lang.String str)
Construct new Message object |
|
Message(int type,
java.util.List list,
java.lang.String str,
long code)
Construct new Message object |
|
Message(int type,
java.lang.String str)
Construct new Message object |
Method Summary | |
---|---|
Client |
getClient()
Get client object from message - first object in clients list |
long |
getCode()
Get code part of the message |
java.util.List |
getList()
Get a list of concerned objects |
long |
getLong()
Get long value part of the message |
java.lang.String |
getText()
Get the text part of the message |
int |
getType()
Get type of the message |
static Message |
recv(java.io.InputStream in)
Receive the message from an input stream |
void |
send(java.io.OutputStream out)
Send the message to an output stream |
Message |
setCode(long code)
Set code part of the message |
Message |
setLong(long longval)
Set long value part of the message |
Message |
setType(int type)
Set type of the message |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int NONE
public static final int HI_TALK
public static final int BYE
public static final int TIMEOUT
public static final int CLIENT_LIST_CHANGED
public static final int NEW_MESSAGE
public static final int MESSAGE_SENT
public static final int DISCONNECT
public static final int REJECT
public static final int ACCEPT
public static final int DEBAR
public static final int DEBAR_SENT
public static final int BROADCAST_SENT
public static final int HI_FILE
public static final int FILE_SENT
public static final int NEW_FILE
public static final int ACCEPT_FILE
public static final int REJECT_FILE
public static final int ACCEPT_FILE_SENT
public static final int REJECT_FILE_SENT
public static final int FILE_RECV
public static final int FILE_UPLOAD_OK
public static final int FILE_DOWNLOAD_OK
public static final int FILE_WAIT
public static final int FILE_DOWNLOAD_START
public static final int FILE_DOWNLOAD_ERROR
private int m_type
private java.util.List m_list
private java.lang.String m_str
private long m_code
private long m_long
Constructor Detail |
---|
public Message(int type)
type
- typepublic Message(int type, java.lang.String str)
type
- typestr
- text part of the messagepublic Message(int type, Client client, java.lang.String str)
type
- typeclient
- message's list of clients, containing only one elementstr
- text part of the messagepublic Message(int type, java.util.List list, java.lang.String str)
type
- typelist
- list of clientsstr
- text part of the messagepublic Message(int type, Client client, java.lang.String str, long code)
type
- typeclient
- message's list of clients, containing only one elementstr
- text part of the messagecode
- code part of the messagepublic Message(int type, java.util.List list, java.lang.String str, long code)
type
- typelist
- list of clientsstr
- text part of the messagecode
- code part of the messageMethod Detail |
---|
public static Message recv(java.io.InputStream in) throws java.io.IOException, java.lang.ClassNotFoundException
in
- input stream
java.io.IOException
java.lang.ClassNotFoundException
public void send(java.io.OutputStream out) throws java.io.IOException, java.lang.ClassNotFoundException
out
- output stream
java.io.IOException
java.lang.ClassNotFoundException
public final Client getClient()
public final java.lang.String getText()
public final java.util.List getList()
public final int getType()
public final long getCode()
public final long getLong()
public final Message setType(int type)
type
- type of the message
public final Message setCode(long code)
code
- code value
public final Message setLong(long longval)
longval
- long value
public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright © 2009 Alexey Veremenko. All rights reserved.