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


Java TXTRecord類代碼示例

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


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

示例1: serviceResolved

import com.apple.dnssd.TXTRecord; //導入依賴的package包/類
@Override
public void serviceResolved(final DNSSDService resolver, final int flags, final int ifIndex,
                            final String fullname, final String hostname, final int port, final TXTRecord txtRecord) {
    if(log.isDebugEnabled()) {
        log.debug(String.format("Resolved service with name %s to %s", fullname, hostname));
    }
    final ActionOperationBatcher autorelease = ActionOperationBatcherFactory.get();
    try {
        String user = null;
        String password = null;
        String path = null;
        if(log.isDebugEnabled()) {
            log.debug(String.format("TXT Record %s", txtRecord));
        }
        if(txtRecord.contains("u")) {
            user = txtRecord.getValueAsString("u");
        }
        if(txtRecord.contains("p")) {
            password = txtRecord.getValueAsString("p");
        }
        if(txtRecord.contains("path")) {
            path = txtRecord.getValueAsString("path");
        }
        this.add(fullname, hostname, port, user, password, path);
    }
    finally {
        // Note: When the desired results have been returned, the client MUST terminate
        // the resolve by calling DNSSDService.stop().
        resolver.stop();
        autorelease.operate();
    }
}
 
開發者ID:iterate-ch,項目名稱:cyberduck,代碼行數:33,代碼來源:RendezvousResponder.java

示例2: MDNSResponderServiceInfo

import com.apple.dnssd.TXTRecord; //導入依賴的package包/類
public MDNSResponderServiceInfo(String serviceName, String hostName, int port, TXTRecord txtRecord) {
    super();
    
    this.serviceName = serviceName;
    this.hostName = hostName;
    this.port = port;
    this.txtRecord = txtRecord;
}
 
開發者ID:loretoparisi,項目名稱:android-mdns-bonjour-discovery,代碼行數:9,代碼來源:MDNSResponderServiceInfo.java

示例3: register

import com.apple.dnssd.TXTRecord; //導入依賴的package包/類
public void register() throws Exception {
	if (m_registered == false) {
		final TXTRecord txt = new TXTRecord();
		if (m_properties != null) {
			for (final String key : m_properties.keySet()) {
				txt.set(key, m_properties.get(key));
			}
		}
		DNSSD.register(0, 0, m_serviceName, m_serviceType, null, null, m_port, txt, this);
	} else {
		System.err.println("WARNING: register() called but the service has already been m_registered!");
	}
}
 
開發者ID:vishwaabhinav,項目名稱:OpenNMS,代碼行數:14,代碼來源:AppleStrategy.java


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