當前位置: 首頁>>代碼示例>>Java>>正文


Java AttributeField類代碼示例

本文整理匯總了Java中gov.nist.javax.sdp.fields.AttributeField的典型用法代碼示例。如果您正苦於以下問題:Java AttributeField類的具體用法?Java AttributeField怎麽用?Java AttributeField使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


AttributeField類屬於gov.nist.javax.sdp.fields包,在下文中一共展示了AttributeField類的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getAttribute

import gov.nist.javax.sdp.fields.AttributeField; //導入依賴的package包/類
/**
 * Returns the value of the specified attribute.
 * 
 * @param name name - the name of the attribute
 * @throws SdpParseException
 * @return the value of the named attribute
 */
public String getAttribute(String name) throws SdpParseException {
  if (name == null)
    return null;
  else if (attributesList == null) return null;
  for (int i = 0; i < attributesList.size(); i++) {
    Object o = attributesList.elementAt(i);
    if (o instanceof AttributeField) {
      AttributeField a = (AttributeField) o;
      String n = a.getName();
      if (n != null) {
        if (name.equals(n)) {
          return a.getValue();
        }
      }
    }
  }
  return null;
}
 
開發者ID:darkmi,項目名稱:rtspproxy,代碼行數:26,代碼來源:SessionDescriptionImpl.java

示例2: removeAttribute

import gov.nist.javax.sdp.fields.AttributeField; //導入依賴的package包/類
/**
 * Removes the attribute specified by the value parameter.
 * 
 * @param name name - the name of the attribute
 */
public void removeAttribute(String name) {
  if (name != null) if (attributesList != null) {
    for (int i = 0; i < attributesList.size(); i++) {
      Object o = attributesList.elementAt(i);
      if (o instanceof AttributeField) {
        AttributeField a = (AttributeField) o;
        try {
          String n = a.getName();
          if (n != null) {
            if (name.equals(n)) {
              attributesList.remove(a);
            }
          }
        } catch (SdpParseException e) {}

      }
    }
  }
}
 
開發者ID:darkmi,項目名稱:rtspproxy,代碼行數:25,代碼來源:SessionDescriptionImpl.java

示例3: setAttribute

import gov.nist.javax.sdp.fields.AttributeField; //導入依賴的package包/類
/**
 * Sets the value of the specified attribute.
 * 
 * @param name name - the name of the attribute.
 * @param value value - the value of the named attribute.
 * @throws SdpException if the name or the value is null
 */
public void setAttribute(String name, String value) throws SdpException {
  if (name == null || value == null)
    throw new SdpException("The parameter is null");
  else if (attributesList != null) {
    for (int i = 0; i < attributesList.size(); i++) {
      Object o = attributesList.elementAt(i);
      if (o instanceof AttributeField) {
        AttributeField a = (AttributeField) o;
        String n = a.getName();
        if (n != null) {
          if (name.equals(n)) {
            a.setValue(value);
          }
        }
      }
    }
  }
}
 
開發者ID:darkmi,項目名稱:rtspproxy,代碼行數:26,代碼來源:SessionDescriptionImpl.java

示例4: testAttribEquals

import gov.nist.javax.sdp.fields.AttributeField; //導入依賴的package包/類
public void testAttribEquals() throws Exception {
    AttributeField f1 = new AttributeFieldParser("a=sendrecv").attributeField();
    AttributeField f2 = new AttributeFieldParser("a=sendrecv").attributeField();
    AttributeField f3 = new AttributeFieldParser("a=sendonly").attributeField();
    AttributeField f4 = new AttributeFieldParser("a=f:sendonly").attributeField();
    AttributeField f5 = new AttributeFieldParser("a=f:sendonly").attributeField();
    AttributeField f6 = new AttributeFieldParser("a=ff:sendonly").attributeField();
    f1.equals(f2); // NPE here Issue 25
    assertEquals(f1, f2);
    assertFalse(f2.equals(f3));
    assertFalse(f4.equals(f3));
    assertEquals(f5, f4);
    assertFalse(f5.equals(f6));
}
 
開發者ID:YunlongYang,項目名稱:LightSIP,代碼行數:15,代碼來源:SdpParserTest.java

示例5: hasAttribute

import gov.nist.javax.sdp.fields.AttributeField; //導入依賴的package包/類
protected boolean hasAttribute(String name) {
  for (int i = 0; i < this.attributeFields.size(); i++) {
    AttributeField af = (AttributeField) this.attributeFields.elementAt(i);
    if (af.getAttribute().getName().equals(name)) return true;
  }
  return false;
}
 
開發者ID:darkmi,項目名稱:rtspproxy,代碼行數:8,代碼來源:MediaDescriptionImpl.java

示例6: getAttribute

import gov.nist.javax.sdp.fields.AttributeField; //導入依賴的package包/類
/**
 * Returns the value of the specified attribute.
 * 
 * @param name the name of the attribute.
 * @throws SdpParseException
 * @return the value of the named attribute
 */
public String getAttribute(String name) throws SdpParseException {
  if (name != null) {
    for (int i = 0; i < this.attributeFields.size(); i++) {
      AttributeField af = (AttributeField) this.attributeFields.elementAt(i);
      if (name.equals(af.getAttribute().getName())) return (String) af.getAttribute().getValue();
    }
    return null;
  } else
    throw new NullPointerException("null arg!");
}
 
開發者ID:darkmi,項目名稱:rtspproxy,代碼行數:18,代碼來源:MediaDescriptionImpl.java

示例7: removeAttribute

import gov.nist.javax.sdp.fields.AttributeField; //導入依賴的package包/類
/**
 * Removes the attribute specified by the value parameter.
 * 
 * @param name the name of the attribute.
 */
public void removeAttribute(String name) {
  if (name == null) throw new NullPointerException("null arg!");
  if (name != null) {
    int i = 0;
    for (i = 0; i < this.attributeFields.size(); i++) {
      AttributeField af = (AttributeField) this.attributeFields.elementAt(i);
      if (af.getAttribute().getName().equals(name)) break;
    }
    if (i < attributeFields.size()) attributeFields.removeElementAt(i);

  }
}
 
開發者ID:darkmi,項目名稱:rtspproxy,代碼行數:18,代碼來源:MediaDescriptionImpl.java

示例8: createAttribute

import gov.nist.javax.sdp.fields.AttributeField; //導入依賴的package包/類
/**
 * 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;
}
 
開發者ID:darkmi,項目名稱:rtspproxy,代碼行數:20,代碼來源:SdpFactory.java

示例9: getAudioData

import gov.nist.javax.sdp.fields.AttributeField; //導入依賴的package包/類
@SuppressWarnings("unchecked")
public final ArrayList<AudioData> getAudioData()
{
	if (getMessage().getRawContent() == null)
		return null;
	ArrayList<AudioData> list = new ArrayList<AudioData>();
	String content = new String(getMessage().getRawContent());
	logger.debug("content=<" + content + ">");
	try {
	    SessionDescription sdp = sdpFactory.createSessionDescription(content);
		String ipAddy = sdp.getConnection().getAddress();
		Vector<MediaDescriptionImpl> descriptors = (Vector<MediaDescriptionImpl>)sdp.getMediaDescriptions(true);
		Iterator<MediaDescriptionImpl> it = descriptors.iterator();
		while (it.hasNext()) {
			MediaDescriptionImpl mediaDescription = it.next();
			MediaField field = mediaDescription.getMediaField();
			if (field == null) {
				logger.warn("Missing media field");
				continue;
			}
			AudioData audio = new AudioData();
			audio.ipAddy = ipAddy;
			audio.rtpPort = field.getPort();
			Vector formats = field.getFormats();
			if (formats == null) {
				list.add(audio);
				continue;
			}
			if (formats.size() < 1) {
				list.add(audio);
				continue;
			}
			audio.payloadType = (String) field.getFormats().get(0);

			Vector attributes = mediaDescription.getAttributeFields();
			if (attributes == null) {
				list.add(audio);
				continue;
			}
			Iterator ait = attributes.iterator();
			while (ait.hasNext()) {
				Object objay = ait.next();
				if (! (objay instanceof AttributeField))
					continue;
				AttributeField afield = (AttributeField)objay;
				if (! "rtpmap".equals(afield.getName()))
					continue;
				String [] parsed = afield.getValue().split("[ /]");
				if (parsed.length < 3)
					continue;
				if (! parsed[0].equals(audio.payloadType))
					continue;
				audio.payloadDescription = parsed[1];
				audio.sampleRate = parsed[2];
			}
			list.add(audio);
			logger.info(getCallId() + " audio=" + audio.toString());
		}
		return list;
	} catch (Exception e) {
		e.printStackTrace();
	}
	return list;
}
 
開發者ID:lmangani,項目名稱:Reaper,代碼行數:65,代碼來源:SipMessage.java

示例10: addAttribute

import gov.nist.javax.sdp.fields.AttributeField; //導入依賴的package包/類
protected void addAttribute(AttributeField af) {
  this.attributeFields.add(af);
}
 
開發者ID:darkmi,項目名稱:rtspproxy,代碼行數:4,代碼來源:MediaDescriptionImpl.java

示例11: addAttribute

import gov.nist.javax.sdp.fields.AttributeField; //導入依賴的package包/類
/**
 * <p>Add Media Attribute based on an AttributeField value</p>
 * 
 * issued by Miguel Freitas (IT) PTInovacao
 * @param at AttributeField
 */
public void addAttribute(AttributeField at);
 
開發者ID:YunlongYang,項目名稱:LightSIP,代碼行數:8,代碼來源:MediaDescription.java


注:本文中的gov.nist.javax.sdp.fields.AttributeField類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。