/** * Returns SessionName object with the specified name. * * @param name the string containing the name of the session. * @return SessionName */ public SessionName createSessionName(String name) { SessionNameField sessionNameImpl = new SessionNameField(); try { sessionNameImpl.setValue(name); } catch (SdpException s) { s.printStackTrace(); } return sessionNameImpl; }
/** * Returns EMail object with the specified value. * * @param value the string containing the description. * @return EMail */ public EMail createEMail(String value) { EmailField emailImpl = new EmailField(); try { emailImpl.setValue(value); } catch (SdpException s) { s.printStackTrace(); } return emailImpl; }
/** * Returns Phone object with the specified value. * * @param value the string containing the description. * @return Phone */ public Phone createPhone(String value) { PhoneField phoneImpl = new PhoneField(); try { phoneImpl.setValue(value); } catch (SdpException s) { s.printStackTrace(); } return phoneImpl; }
/** * Returns Info object with the specified value. * * @param value the string containing the description. * @return Info */ public Info createInfo(String value) { InformationField infoImpl = new InformationField(); try { infoImpl.setValue(value); } catch (SdpException s) { s.printStackTrace(); } return infoImpl; }
/** * Constructs a timezone adjustment record. * * @param d the Date at which the adjustment is going to take place. * @param offset the adjustment in number of seconds relative to the start time of the * SessionDescription with which this object is associated. * @return TimeZoneAdjustment */ public TimeZoneAdjustment createTimeZoneAdjustment(Date d, int offset) { ZoneField timeZoneAdjustmentImpl = new ZoneField(); try { Hashtable map = new Hashtable(); map.put(d, new Integer(offset)); timeZoneAdjustmentImpl.setZoneAdjustments(map); } catch (SdpException s) { s.printStackTrace(); } return timeZoneAdjustmentImpl; }
/** * Returns Version object with the specified values. * * @param value the version number. * @return Version */ public Version createVersion(int value) { ProtoVersionField protoVersionField = new ProtoVersionField(); try { protoVersionField.setVersion(value); } catch (SdpException s) { s.printStackTrace(); return null; } return protoVersionField; }
/** * Returns Attribute object with the specified values. * * @param name the namee of the attribute * @param value the value of the attribute * @return Attribute */ public Attribute createAttribute(String name, String value) { AttributeField attributeImpl = new AttributeField(); try { attributeImpl.setName(name); attributeImpl.setValue(value); } catch (SdpException s) { s.printStackTrace(); } return attributeImpl; }
/** * Returns Bandwidth object with the specified values. * * @param modifier modifier - the bandwidth type * @param value the bandwidth value measured in kilobits per second * @return bandwidth */ public BandWidth createBandwidth(String modifier, int value) { BandwidthField bandWidthImpl = new BandwidthField(); try { bandWidthImpl.setType(modifier); bandWidthImpl.setValue(value); } catch (SdpException s) { s.printStackTrace(); } return bandWidthImpl; }
/** * Returns a RepeatTime object with the specified interval, duration, and time offsets. * * @param repeatInterval the "repeat interval" in seconds * @param activeDuration the "active duration" in seconds * @param offsets the list of offsets relative to the start time of the Time object with which the * returned RepeatTime will be associated * @return RepeatTime */ public RepeatTime createRepeatTime(int repeatInterval, int activeDuration, int[] offsets) { RepeatField repeatTimeField = new RepeatField(); try { repeatTimeField.setRepeatInterval(repeatInterval); repeatTimeField.setActiveDuration(activeDuration); repeatTimeField.setOffsetArray(offsets); } catch (SdpException s) { s.printStackTrace(); } return repeatTimeField; }
/** * Returns Key object with the specified value. * * @param method the string containing the method type. * @param key the key to set * @return Key */ public Key createKey(String method, String key) { KeyField keyImpl = new KeyField(); try { keyImpl.setMethod(method); keyImpl.setKey(key); } catch (SdpException s) { s.printStackTrace(); return null; } return keyImpl; }
/** * Returns MediaDescription object with the specified properties. The returned object will respond * to Media.getMediaFormats(boolean) with a Vector of String objects specified by the 'formats * argument. * * @param media the media type, eg "audio" * @param port port number on which to receive media * @param numPorts number of ports used for this media stream * @param transport transport type, eg "RTP/AVP" * @param formats list of formats which should be specified by the returned MediaDescription * @return MediaDescription */ public MediaDescription createMediaDescription( String media, int port, int numPorts, String transport, String[] formats) { MediaDescriptionImpl mediaDescriptionImpl = new MediaDescriptionImpl(); try { MediaField mediaImpl = new MediaField(); mediaImpl.setMediaType(media); mediaImpl.setMediaPort(port); mediaImpl.setPortCount(numPorts); mediaImpl.setProtocol(transport); Vector formatsV = new Vector(formats.length); for (int i = 0; i < formats.length; i++) formatsV.add(formats[i]); mediaImpl.setMediaFormats(formatsV); mediaDescriptionImpl.setMedia(mediaImpl); } catch (SdpException s) { s.printStackTrace(); } return mediaDescriptionImpl; }