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


Java ServiceInfo.getTextBytes方法代碼示例

本文整理匯總了Java中javax.jmdns.ServiceInfo.getTextBytes方法的典型用法代碼示例。如果您正苦於以下問題:Java ServiceInfo.getTextBytes方法的具體用法?Java ServiceInfo.getTextBytes怎麽用?Java ServiceInfo.getTextBytes使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.jmdns.ServiceInfo的用法示例。


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

示例1: ServiceInfoImpl

import javax.jmdns.ServiceInfo; //導入方法依賴的package包/類
/**
 * During recovery we need to duplicate service info to reregister them
 *
 * @param info
 */
public ServiceInfoImpl(ServiceInfo info)
{
    if (info != null)
    {
        this._domain = info.getDomain();
        this._protocol = info.getProtocol();
        this._application = info.getApplication();
        this._name = info.getName();
        this._subtype = info.getSubtype();
        this._port = info.getPort();
        this._weight = info.getWeight();
        this._priority = info.getPriority();
        this._text = info.getTextBytes();
        this._persistent = info.isPersistent();
        this._ipv4Addr = info.getInet4Address();
        this._ipv6Addr = info.getInet6Address();
    }
    this._state = new ServiceInfoState(this);
}
 
開發者ID:blackshadowwalker,項目名稱:log4j-collector,代碼行數:25,代碼來源:ServiceInfoImpl.java

示例2: _sameInfo

import javax.jmdns.ServiceInfo; //導入方法依賴的package包/類
private static final boolean _sameInfo(ServiceInfo info, ServiceInfo lastInfo)
{
    if (info == null)
        return false;
    if (lastInfo == null)
        return false;
    if (!info.equals(lastInfo))
        return false;
    byte[] text = info.getTextBytes();
    byte[] lastText = lastInfo.getTextBytes();
    if (text.length != lastText.length)
        return false;
    for (int i = 0; i < text.length; i++)
    {
        if (text[i] != lastText[i])
            return false;
    }
    return true;
}
 
開發者ID:blackshadowwalker,項目名稱:log4j-collector,代碼行數:20,代碼來源:ListenerStatus.java

示例3: _sameInfo

import javax.jmdns.ServiceInfo; //導入方法依賴的package包/類
private static final boolean _sameInfo(ServiceInfo info, ServiceInfo lastInfo) {
    if (info == null) return false;
    if (lastInfo == null) return false;
    if (!info.equals(lastInfo)) return false;
    byte[] text = info.getTextBytes();
    byte[] lastText = lastInfo.getTextBytes();
    if (text.length != lastText.length) return false;
    for (int i = 0; i < text.length; i++) {
        if (text[i] != lastText[i]) return false;
    }
    return true;
}
 
開發者ID:iilxy,項目名稱:AndroidmDNS,代碼行數:13,代碼來源:ListenerStatus.java

示例4: __parseSeviceInfo2IOTAddress

import javax.jmdns.ServiceInfo; //導入方法依賴的package包/類
private static IOTAddress __parseSeviceInfo2IOTAddress(ServiceInfo serviceInfo)
{
    byte[] textBytes = serviceInfo.getTextBytes();
    log.debug("__parseSeviceInfo2IOTAddress(): textBytes toString: " + new String(textBytes));
    // check whether the serviceInfo is valid
    int index = 0;
    while (index < textBytes.length)
    {
        index += (1 + textBytes[index]);
    }
    if (index != textBytes.length)
    {
        log.warn("__parseSeviceInfo2IOTAddress(): bad serviceInfo format, return null");
        return null;
    }
    // get InetAddress
    InetAddress inetAddress = null;
    inetAddress = serviceInfo.getInet4Addresses()[0];
    // get bssid, device type, device version
    Map<String, String> keyValue = new HashMap<String, String>();
    index = 0;
    String part = null;
    String[] subParts = null;
    while (index < textBytes.length)
    {
        part = new String(textBytes, index + 1, textBytes[index]);
        subParts = part.split("=");
        // if the content is invalid, just ignore it
        if (subParts.length == 2)
        {
            keyValue.put(subParts[0], subParts[1]);
        }
        index += (1 + textBytes[index]);
    }
    String bssid = keyValue.get(KEY_BSSID);
    String type = keyValue.get(KEY_TYPE);
    if (bssid == null || type == null)
    {
        log.warn("__parseSeviceInfo2IOTAddress(): bssid = null or type = null, return null");
        return null;
    }
    EspDeviceType deviceType = EspDeviceType.getEspTypeEnumByString(type);
    if (deviceType == null)
    {
        log.warn("__parseSeviceInfo2IOTAddress(): deviceType = null, return null");
        return null;
    }
    IOTAddress iotAddress = new IOTAddress(bssid, inetAddress);
    iotAddress.setEspDeviceTypeEnum(deviceType);
    return iotAddress;
}
 
開發者ID:EspressifApp,項目名稱:IOT-Espressif-Android,代碼行數:52,代碼來源:MdnsDiscoverUtil.java


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