FileDocCategorySizeDatePackage
Message.javaAPI DocJMF 2.1.1e1919Mon May 12 12:20:54 BST 2003com.sun.media.rtsp.protocol

Message

public class Message extends Object

Fields Summary
private byte[]
data
private int
type
private Object
parameter
Constructors Summary
public Message(int type, Object parameter)

    
public Message(byte[] data)

        this.data = data;

        parseData();
    
Methods Summary
public java.lang.ObjectgetParameter()

        return parameter;
    
public intgetType()

        return type;
    
private voidparseData()

        StringTokenizer st = new StringTokenizer(new String(data));

        type = new MessageType(st.nextToken()).getType();

        switch (type) {
            case MessageType.DESCRIBE:
                parameter = (Object) new DescribeMessage(data);
                break;
            case MessageType.SETUP:
                parameter = (Object) new SetupMessage(data);
                break;
            case MessageType.PLAY:
                parameter = (Object) new PlayMessage(data);
                break;
            case MessageType.PAUSE:
                parameter = (Object) new PauseMessage(data);
                break;
            case MessageType.TEARDOWN:
                parameter = (Object) new TeardownMessage(data);
                break;
            case MessageType.OPTIONS:
                parameter = (Object) new OptionsMessage(data);
                break;
            case MessageType.RESPONSE:
                parameter = (Object) new ResponseMessage(data);
                break;
            case MessageType.SET_PARAMETER:
                parameter = (Object) new SetParameterMessage(data);
                break;
            default:
                Debug.println("Unknown msg type: " + type);
                Debug.println("Unknown msg type: " + new String(data));
                break;
        }