本文整理匯總了Java中org.fourthline.cling.model.message.header.UpnpHeader.Type方法的典型用法代碼示例。如果您正苦於以下問題:Java UpnpHeader.Type方法的具體用法?Java UpnpHeader.Type怎麽用?Java UpnpHeader.Type使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.fourthline.cling.model.message.header.UpnpHeader
的用法示例。
在下文中一共展示了UpnpHeader.Type方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: parseHeaders
import org.fourthline.cling.model.message.header.UpnpHeader; //導入方法依賴的package包/類
protected void parseHeaders() {
// This runs as late as possible and only when necessary (getter called and map is dirty)
parsedHeaders = new LinkedHashMap();
if (log.isLoggable(Level.FINE))
log.fine("Parsing all HTTP headers for known UPnP headers: " + size());
for (Entry<String, List<String>> entry : entrySet()) {
if (entry.getKey() == null) continue; // Oh yes, the JDK has 'null' HTTP headers
UpnpHeader.Type type = UpnpHeader.Type.getByHttpName(entry.getKey());
if (type == null) {
if (log.isLoggable(Level.FINE))
log.fine("Ignoring non-UPNP HTTP header: " + entry.getKey());
continue;
}
for (String value : entry.getValue()) {
UpnpHeader upnpHeader = UpnpHeader.newInstance(type, value);
if (upnpHeader == null || upnpHeader.getValue() == null) {
if (log.isLoggable(Level.FINE))
log.fine(
"Ignoring known but irrelevant header (value violates the UDA specification?) '"
+ type.getHttpName()
+ "': "
+ value
);
} else {
addParsedValue(type, upnpHeader);
}
}
}
}
示例2: addParsedValue
import org.fourthline.cling.model.message.header.UpnpHeader; //導入方法依賴的package包/類
protected void addParsedValue(UpnpHeader.Type type, UpnpHeader value) {
if (log.isLoggable(Level.FINE))
log.fine("Adding parsed header: " + value);
List<UpnpHeader> list = parsedHeaders.get(type);
if (list == null) {
list = new LinkedList();
parsedHeaders.put(type, list);
}
list.add(value);
}
示例3: getFirstHeader
import org.fourthline.cling.model.message.header.UpnpHeader; //導入方法依賴的package包/類
public <H extends UpnpHeader> H getFirstHeader(UpnpHeader.Type type, Class<H> subtype) {
UpnpHeader[] headers = getAsArray(type);
if (headers.length == 0) return null;
for (UpnpHeader header : headers) {
if (subtype.isAssignableFrom(header.getClass())) {
return (H) header;
}
}
return null;
}
示例4: getFirstHeader
import org.fourthline.cling.model.message.header.UpnpHeader; //導入方法依賴的package包/類
protected <H extends UpnpHeader> H getFirstHeader(UpnpHeader.Type headerType, Class<H> subtype) {
return getInputMessage().getHeaders().getFirstHeader(headerType, subtype);
}
示例5: containsKey
import org.fourthline.cling.model.message.header.UpnpHeader; //導入方法依賴的package包/類
public boolean containsKey(UpnpHeader.Type type) {
if (parsedHeaders == null) parseHeaders();
return parsedHeaders.containsKey(type);
}
示例6: get
import org.fourthline.cling.model.message.header.UpnpHeader; //導入方法依賴的package包/類
public List<UpnpHeader> get(UpnpHeader.Type type) {
if (parsedHeaders == null) parseHeaders();
return parsedHeaders.get(type);
}
示例7: add
import org.fourthline.cling.model.message.header.UpnpHeader; //導入方法依賴的package包/類
public void add(UpnpHeader.Type type, UpnpHeader value) {
super.add(type.getHttpName(), value.getString());
if (parsedHeaders != null)
addParsedValue(type, value);
}
示例8: remove
import org.fourthline.cling.model.message.header.UpnpHeader; //導入方法依賴的package包/類
public void remove(UpnpHeader.Type type) {
super.remove(type.getHttpName());
if (parsedHeaders != null)
parsedHeaders.remove(type);
}
示例9: getAsArray
import org.fourthline.cling.model.message.header.UpnpHeader; //導入方法依賴的package包/類
public UpnpHeader[] getAsArray(UpnpHeader.Type type) {
if (parsedHeaders == null) parseHeaders();
return parsedHeaders.get(type) != null
? parsedHeaders.get(type).toArray(new UpnpHeader[parsedHeaders.get(type).size()])
: new UpnpHeader[0];
}
示例10: getFirstHeaderString
import org.fourthline.cling.model.message.header.UpnpHeader; //導入方法依賴的package包/類
public String getFirstHeaderString(UpnpHeader.Type type) {
UpnpHeader header = getFirstHeader(type);
return header != null ? header.getString() : null;
}