// Media Name and Transport Address:
String line = getLine(bin);
int end = line.indexOf(' ");
name = line.substring(0, end);
int start = end + 1;
end = line.indexOf(' ", start);
port = line.substring(start, end);
start = end + 1;
end = line.indexOf(' ", start);
protocol = line.substring(start, end);
start = end + 1;
payload = line.substring(start);
try {
payload_type = new Integer(payload).intValue();
} catch (Exception e) {
payload_type = -1;
}
// Session and Media Information:
if (getToken(bin, "i=", false)) {
mediaTitle = getLine(bin);
System.out.println("media title: " + mediaTitle);
}
// Connection Information:
boolean mandatory = true;
if (connectionIncluded) {
mandatory = false;
}
if (getToken(bin, "c=", mandatory)) {
connectionInfo = getLine(bin);
System.out.println("connection info: " + connectionInfo);
}
// Bandwidth Information:
if (getToken(bin, "b=", false)) {
bandwidthInfo = getLine(bin);
System.out.println("bandwidth info: " + bandwidthInfo);
}
// Encryption Key:
if (getToken(bin, "k=", false)) {
encryptionKey = getLine(bin);
System.out.println("encryption key: " + encryptionKey);
}
// Media Attributes:
mediaAttributes = new Vector();
boolean found = getToken(bin, "a=", false);
while (found) {
String mediaAttribute = getLine(bin);
int index = mediaAttribute.indexOf(':");
if (index > 0) {
String name = mediaAttribute.substring(0, index);
String value = mediaAttribute.substring(index + 1);
MediaAttribute attribute = new MediaAttribute(name, value);
mediaAttributes.addElement(attribute);
}
found = getToken(bin, "a=", false);
}