• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java DNSRecordClass类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中javax.jmdns.impl.constants.DNSRecordClass的典型用法代码示例。如果您正苦于以下问题:Java DNSRecordClass类的具体用法?Java DNSRecordClass怎么用?Java DNSRecordClass使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



DNSRecordClass类属于javax.jmdns.impl.constants包,在下文中一共展示了DNSRecordClass类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getDNSEntry

import javax.jmdns.impl.constants.DNSRecordClass; //导入依赖的package包/类
/**
 * Get a matching DNS entry from the table.
 *
 * @param name
 * @param type
 * @param recordClass
 * @return DNSEntry
 */
public DNSEntry getDNSEntry(String name, DNSRecordType type, DNSRecordClass recordClass) {
    DNSEntry result = null;
    Collection<? extends DNSEntry> entryList = this._getDNSEntryList(name);
    if (entryList != null) {
        synchronized (entryList) {
            for (DNSEntry testDNSEntry : entryList) {
                if (testDNSEntry.matchRecordType(type) && testDNSEntry.matchRecordClass(recordClass)) {
                    result = testDNSEntry;
                    break;
                }
            }
        }
    }
    return result;
}
 
开发者ID:iilxy,项目名称:AndroidmDNS,代码行数:24,代码来源:DNSCache.java


示例2: getDNSEntryList

import javax.jmdns.impl.constants.DNSRecordClass; //导入依赖的package包/类
/**
 * Get all matching DNS entries from the table.
 *
 * @param name
 * @param type
 * @param recordClass
 * @return list of entries
 */
public Collection<? extends DNSEntry> getDNSEntryList(String name, DNSRecordType type, DNSRecordClass recordClass) {
    Collection<? extends DNSEntry> entryList = this._getDNSEntryList(name);
    if (entryList != null) {
        synchronized (entryList) {
            entryList = new ArrayList<DNSEntry>(entryList);
            for (Iterator<? extends DNSEntry> i = entryList.iterator(); i.hasNext();) {
                DNSEntry testDNSEntry = i.next();
                if (!testDNSEntry.matchRecordType(type) || (!testDNSEntry.matchRecordClass(recordClass))) {
                    i.remove();
                }
            }
        }
    } else {
        entryList = Collections.emptyList();
    }
    return entryList;
}
 
开发者ID:iilxy,项目名称:AndroidmDNS,代码行数:26,代码来源:DNSCache.java


示例3: newQuestion

import javax.jmdns.impl.constants.DNSRecordClass; //导入依赖的package包/类
/**
 * Create a question.
 *
 * @param name
 *            DNS name to be resolved
 * @param type
 *            Record type to resolve
 * @param recordClass
 *            Record class to resolve
 * @param unique
 *            Request unicast response (Currently not supported in this implementation)
 * @return new question
 */
public static DNSQuestion newQuestion(String name, DNSRecordType type, DNSRecordClass recordClass, boolean unique) {
    switch (type) {
        case TYPE_A:
            return new DNS4Address(name, type, recordClass, unique);
        case TYPE_A6:
            return new DNS6Address(name, type, recordClass, unique);
        case TYPE_AAAA:
            return new DNS6Address(name, type, recordClass, unique);
        case TYPE_ANY:
            return new AllRecords(name, type, recordClass, unique);
        case TYPE_HINFO:
            return new HostInformation(name, type, recordClass, unique);
        case TYPE_PTR:
            return new Pointer(name, type, recordClass, unique);
        case TYPE_SRV:
            return new Service(name, type, recordClass, unique);
        case TYPE_TXT:
            return new Text(name, type, recordClass, unique);
        default:
            return new DNSQuestion(name, type, recordClass, unique);
    }
}
 
开发者ID:iilxy,项目名称:AndroidmDNS,代码行数:36,代码来源:DNSQuestion.java


示例4: addQuestions

import javax.jmdns.impl.constants.DNSRecordClass; //导入依赖的package包/类
@Override
protected DNSOutgoing addQuestions(DNSOutgoing out) throws IOException
{
    DNSOutgoing newOut = out;
    if (!_info.hasData())
    {
        newOut = this.addQuestion(newOut, DNSQuestion.newQuestion(_info.getQualifiedName(), DNSRecordType.TYPE_SRV, DNSRecordClass.CLASS_IN, DNSRecordClass.NOT_UNIQUE));
        newOut = this.addQuestion(newOut, DNSQuestion.newQuestion(_info.getQualifiedName(), DNSRecordType.TYPE_TXT, DNSRecordClass.CLASS_IN, DNSRecordClass.NOT_UNIQUE));
        if (_info.getServer().length() > 0)
        {
            newOut = this.addQuestion(newOut, DNSQuestion.newQuestion(_info.getServer(), DNSRecordType.TYPE_A, DNSRecordClass.CLASS_IN, DNSRecordClass.NOT_UNIQUE));
            newOut = this.addQuestion(newOut, DNSQuestion.newQuestion(_info.getServer(), DNSRecordType.TYPE_AAAA, DNSRecordClass.CLASS_IN, DNSRecordClass.NOT_UNIQUE));
        }
    }
    return newOut;
}
 
开发者ID:blackshadowwalker,项目名称:log4j-collector,代码行数:17,代码来源:ServiceInfoResolver.java


示例5: addAnswers

import javax.jmdns.impl.constants.DNSRecordClass; //导入依赖的package包/类
@Override
protected DNSOutgoing addAnswers(DNSOutgoing out) throws IOException
{
    DNSOutgoing newOut = out;
    if (!_info.hasData())
    {
        long now = System.currentTimeMillis();
        newOut = this.addAnswer(newOut, (DNSRecord) this.getDns().getCache().getDNSEntry(_info.getQualifiedName(), DNSRecordType.TYPE_SRV, DNSRecordClass.CLASS_IN), now);
        newOut = this.addAnswer(newOut, (DNSRecord) this.getDns().getCache().getDNSEntry(_info.getQualifiedName(), DNSRecordType.TYPE_TXT, DNSRecordClass.CLASS_IN), now);
        if (_info.getServer().length() > 0)
        {
            newOut = this.addAnswer(newOut, (DNSRecord) this.getDns().getCache().getDNSEntry(_info.getServer(), DNSRecordType.TYPE_A, DNSRecordClass.CLASS_IN), now);
            newOut = this.addAnswer(newOut, (DNSRecord) this.getDns().getCache().getDNSEntry(_info.getServer(), DNSRecordType.TYPE_AAAA, DNSRecordClass.CLASS_IN), now);
        }
    }
    return newOut;
}
 
开发者ID:blackshadowwalker,项目名称:log4j-collector,代码行数:18,代码来源:ServiceInfoResolver.java


示例6: getDNSEntryList

import javax.jmdns.impl.constants.DNSRecordClass; //导入依赖的package包/类
/**
 * Get all matching DNS entries from the table.
 *
 * @param name
 * @param type
 * @param recordClass
 * @return list of entries
 */
public synchronized Collection<? extends DNSEntry> getDNSEntryList(String name, DNSRecordType type, DNSRecordClass recordClass) {
    Collection<? extends DNSEntry> entryList = this._getDNSEntryList(name);
    if (entryList != null) {
        entryList = new ArrayList<DNSEntry>(entryList);
        for (Iterator<? extends DNSEntry> i = entryList.iterator(); i.hasNext();) {
            DNSEntry testDNSEntry = i.next();
            if (!testDNSEntry.getRecordType().equals(type) || ((DNSRecordClass.CLASS_ANY != recordClass) && !testDNSEntry.getRecordClass().equals(recordClass))) {
                i.remove();
            }
        }
    } else {
        entryList = Collections.emptyList();
    }
    return entryList;
}
 
开发者ID:DeviceConnect,项目名称:DeviceConnect-Android,代码行数:24,代码来源:DNSCache.java


示例7: DNSEntry

import javax.jmdns.impl.constants.DNSRecordClass; //导入依赖的package包/类
/**
 * Create an entry.
 */
DNSEntry(String name, DNSRecordType type, DNSRecordClass recordClass, boolean unique) {
    _name = name;
    // _key = (name != null ? name.trim().toLowerCase() : null);
    _recordType = type;
    _dnsClass = recordClass;
    _unique = unique;
    _qualifiedNameMap = ServiceInfoImpl.decodeQualifiedNameMapForType(this.getName());
    String domain = _qualifiedNameMap.get(Fields.Domain);
    String protocol = _qualifiedNameMap.get(Fields.Protocol);
    String application = _qualifiedNameMap.get(Fields.Application);
    String instance = _qualifiedNameMap.get(Fields.Instance).toLowerCase();
    _type = (application.length() > 0 ? "_" + application + "." : "") + (protocol.length() > 0 ? "_" + protocol + "." : "") + domain + ".";
    _key = ((instance.length() > 0 ? instance + "." : "") + _type).toLowerCase();
}
 
开发者ID:iilxy,项目名称:AndroidmDNS,代码行数:18,代码来源:DNSEntry.java


示例8: buildOutgoingForDNS

import javax.jmdns.impl.constants.DNSRecordClass; //导入依赖的package包/类
@Override
protected DNSOutgoing buildOutgoingForDNS(DNSOutgoing out) throws IOException {
    DNSOutgoing newOut = out;
    for (DNSRecord answer : this.getDns().getLocalHost().answers(DNSRecordClass.CLASS_ANY, DNSRecordClass.UNIQUE, this.getTTL())) {
        newOut = this.addAnswer(newOut, null, answer);
    }
    return newOut;
}
 
开发者ID:iilxy,项目名称:AndroidmDNS,代码行数:9,代码来源:Announcer.java


示例9: buildOutgoingForInfo

import javax.jmdns.impl.constants.DNSRecordClass; //导入依赖的package包/类
@Override
protected DNSOutgoing buildOutgoingForInfo(ServiceInfoImpl info, DNSOutgoing out) throws IOException {
    DNSOutgoing newOut = out;
    for (DNSRecord answer : info.answers(DNSRecordClass.CLASS_ANY, DNSRecordClass.UNIQUE, this.getTTL(), this.getDns().getLocalHost())) {
        newOut = this.addAnswer(newOut, null, answer);
    }
    return newOut;
}
 
开发者ID:iilxy,项目名称:AndroidmDNS,代码行数:9,代码来源:Announcer.java


示例10: buildOutgoingForDNS

import javax.jmdns.impl.constants.DNSRecordClass; //导入依赖的package包/类
@Override
protected DNSOutgoing buildOutgoingForDNS(DNSOutgoing out) throws IOException {
    DNSOutgoing newOut = out;
    newOut.addQuestion(DNSQuestion.newQuestion(this.getDns().getLocalHost().getName(), DNSRecordType.TYPE_ANY, DNSRecordClass.CLASS_IN, DNSRecordClass.NOT_UNIQUE));
    for (DNSRecord answer : this.getDns().getLocalHost().answers(DNSRecordClass.CLASS_ANY, DNSRecordClass.NOT_UNIQUE, this.getTTL())) {
        newOut = this.addAuthoritativeAnswer(newOut, answer);
    }
    return newOut;
}
 
开发者ID:iilxy,项目名称:AndroidmDNS,代码行数:10,代码来源:Prober.java


示例11: buildOutgoingForInfo

import javax.jmdns.impl.constants.DNSRecordClass; //导入依赖的package包/类
@Override
protected DNSOutgoing buildOutgoingForInfo(ServiceInfoImpl info, DNSOutgoing out) throws IOException {
    DNSOutgoing newOut = out;
    newOut = this.addQuestion(newOut, DNSQuestion.newQuestion(info.getQualifiedName(), DNSRecordType.TYPE_ANY, DNSRecordClass.CLASS_IN, DNSRecordClass.NOT_UNIQUE));
    // the "unique" flag should be not set here because these answers haven't been proven unique yet this means the record will not exactly match the announcement record
    newOut = this.addAuthoritativeAnswer(newOut, new DNSRecord.Service(info.getQualifiedName(), DNSRecordClass.CLASS_IN, DNSRecordClass.NOT_UNIQUE, this.getTTL(), info.getPriority(), info.getWeight(), info.getPort(), this.getDns().getLocalHost()
            .getName()));
    return newOut;
}
 
开发者ID:iilxy,项目名称:AndroidmDNS,代码行数:10,代码来源:Prober.java


示例12: addAnswers

import javax.jmdns.impl.constants.DNSRecordClass; //导入依赖的package包/类
@Override
protected DNSOutgoing addAnswers(DNSOutgoing out) throws IOException {
    DNSOutgoing newOut = out;
    long now = System.currentTimeMillis();
    for (ServiceInfo info : this.getDns().getServices().values()) {
        newOut = this.addAnswer(newOut, new DNSRecord.Pointer(info.getType(), DNSRecordClass.CLASS_IN, DNSRecordClass.NOT_UNIQUE, DNSConstants.DNS_TTL, info.getQualifiedName()), now);
        // newOut = this.addAnswer(newOut, new DNSRecord.Service(info.getQualifiedName(), DNSRecordClass.CLASS_IN, DNSRecordClass.NOT_UNIQUE, DNSConstants.DNS_TTL, info.getPriority(), info.getWeight(), info.getPort(),
        // this.getDns().getLocalHost().getName()), now);
    }
    return newOut;
}
 
开发者ID:iilxy,项目名称:AndroidmDNS,代码行数:12,代码来源:ServiceResolver.java


示例13: addQuestions

import javax.jmdns.impl.constants.DNSRecordClass; //导入依赖的package包/类
@Override
protected DNSOutgoing addQuestions(DNSOutgoing out) throws IOException {
    DNSOutgoing newOut = out;
    newOut = this.addQuestion(newOut, DNSQuestion.newQuestion(_type, DNSRecordType.TYPE_PTR, DNSRecordClass.CLASS_IN, DNSRecordClass.NOT_UNIQUE));
    // newOut = this.addQuestion(newOut, DNSQuestion.newQuestion(_type, DNSRecordType.TYPE_SRV, DNSRecordClass.CLASS_IN, DNSRecordClass.NOT_UNIQUE));
    return newOut;
}
 
开发者ID:iilxy,项目名称:AndroidmDNS,代码行数:8,代码来源:ServiceResolver.java


示例14: addAnswers

import javax.jmdns.impl.constants.DNSRecordClass; //导入依赖的package包/类
@Override
protected DNSOutgoing addAnswers(DNSOutgoing out) throws IOException {
    DNSOutgoing newOut = out;
    long now = System.currentTimeMillis();
    for (String type : this.getDns().getServiceTypes().keySet()) {
        ServiceTypeEntry typeEntry = this.getDns().getServiceTypes().get(type);
        newOut = this.addAnswer(newOut, new DNSRecord.Pointer("_services._dns-sd._udp.local.", DNSRecordClass.CLASS_IN, DNSRecordClass.NOT_UNIQUE, DNSConstants.DNS_TTL, typeEntry.getType()), now);
    }
    return newOut;
}
 
开发者ID:iilxy,项目名称:AndroidmDNS,代码行数:11,代码来源:TypeResolver.java


示例15: addQuestions

import javax.jmdns.impl.constants.DNSRecordClass; //导入依赖的package包/类
@Override
protected DNSOutgoing addQuestions(DNSOutgoing out) throws IOException {
    DNSOutgoing newOut = out;
    if (!_info.hasData()) {
        newOut = this.addQuestion(newOut, DNSQuestion.newQuestion(_info.getQualifiedName(), DNSRecordType.TYPE_SRV, DNSRecordClass.CLASS_IN, DNSRecordClass.NOT_UNIQUE));
        newOut = this.addQuestion(newOut, DNSQuestion.newQuestion(_info.getQualifiedName(), DNSRecordType.TYPE_TXT, DNSRecordClass.CLASS_IN, DNSRecordClass.NOT_UNIQUE));
        if (_info.getServer().length() > 0) {
            newOut = this.addQuestion(newOut, DNSQuestion.newQuestion(_info.getServer(), DNSRecordType.TYPE_A, DNSRecordClass.CLASS_IN, DNSRecordClass.NOT_UNIQUE));
            newOut = this.addQuestion(newOut, DNSQuestion.newQuestion(_info.getServer(), DNSRecordType.TYPE_AAAA, DNSRecordClass.CLASS_IN, DNSRecordClass.NOT_UNIQUE));
        }
    }
    return newOut;
}
 
开发者ID:iilxy,项目名称:AndroidmDNS,代码行数:14,代码来源:ServiceInfoResolver.java


示例16: getDNS4ReverseAddressRecord

import javax.jmdns.impl.constants.DNSRecordClass; //导入依赖的package包/类
private DNSRecord.Pointer getDNS4ReverseAddressRecord(boolean unique, int ttl) {
    if (this.getInetAddress() instanceof Inet4Address) {
        return new DNSRecord.Pointer(this.getInetAddress().getHostAddress() + ".in-addr.arpa.", DNSRecordClass.CLASS_IN, unique, ttl, this.getName());
    }
    if ((this.getInetAddress() instanceof Inet6Address) && (((Inet6Address) this.getInetAddress()).isIPv4CompatibleAddress())) {
        byte[] rawAddress = this.getInetAddress().getAddress();
        String address = (rawAddress[12] & 0xff) + "." + (rawAddress[13] & 0xff) + "." + (rawAddress[14] & 0xff) + "." + (rawAddress[15] & 0xff);
        return new DNSRecord.Pointer(address + ".in-addr.arpa.", DNSRecordClass.CLASS_IN, unique, ttl, this.getName());
    }
    return null;
}
 
开发者ID:iilxy,项目名称:AndroidmDNS,代码行数:12,代码来源:HostInfo.java


示例17: answers

import javax.jmdns.impl.constants.DNSRecordClass; //导入依赖的package包/类
public Collection<DNSRecord> answers(DNSRecordClass recordClass, boolean unique, int ttl) {
    List<DNSRecord> list = new ArrayList<DNSRecord>();
    DNSRecord answer = this.getDNS4AddressRecord(unique, ttl);
    if ((answer != null) && answer.matchRecordClass(recordClass)) {
        list.add(answer);
    }
    answer = this.getDNS6AddressRecord(unique, ttl);
    if ((answer != null) && answer.matchRecordClass(recordClass)) {
        list.add(answer);
    }
    return list;
}
 
开发者ID:iilxy,项目名称:AndroidmDNS,代码行数:13,代码来源:HostInfo.java


示例18: answers

import javax.jmdns.impl.constants.DNSRecordClass; //导入依赖的package包/类
/**
 * Create a series of answer that correspond with the give service info.
 *
 * @param recordClass
 *            record class of the query
 * @param unique
 * @param ttl
 * @param localHost
 * @return collection of answers
 */
public Collection<DNSRecord> answers(DNSRecordClass recordClass, boolean unique, int ttl, HostInfo localHost) {
    List<DNSRecord> list = new ArrayList<DNSRecord>();
    // [PJYF Dec 6 2011] This is bad hack as I don't know what the spec should really means in this case. i.e. what is the class of our registered services.
    if ((recordClass == DNSRecordClass.CLASS_ANY) || (recordClass == DNSRecordClass.CLASS_IN)) {
        if (this.getSubtype().length() > 0) {
            list.add(new Pointer(this.getTypeWithSubtype(), DNSRecordClass.CLASS_IN, DNSRecordClass.NOT_UNIQUE, ttl, this.getQualifiedName()));
        }
        list.add(new Pointer(this.getType(), DNSRecordClass.CLASS_IN, DNSRecordClass.NOT_UNIQUE, ttl, this.getQualifiedName()));
        list.add(new Service(this.getQualifiedName(), DNSRecordClass.CLASS_IN, unique, ttl, _priority, _weight, _port, localHost.getName()));
        list.add(new Text(this.getQualifiedName(), DNSRecordClass.CLASS_IN, unique, ttl, this.getTextBytes()));
    }
    return list;
}
 
开发者ID:iilxy,项目名称:AndroidmDNS,代码行数:24,代码来源:ServiceInfoImpl.java


示例19: readQuestion

import javax.jmdns.impl.constants.DNSRecordClass; //导入依赖的package包/类
private DNSQuestion readQuestion() {
    String domain = _messageInputStream.readName();
    DNSRecordType type = DNSRecordType.typeForIndex(_messageInputStream.readUnsignedShort());
    if (type == DNSRecordType.TYPE_IGNORE) {
        logger.log(Level.SEVERE, "Could not find record type: " + this.print(true));
    }
    int recordClassIndex = _messageInputStream.readUnsignedShort();
    DNSRecordClass recordClass = DNSRecordClass.classForIndex(recordClassIndex);
    boolean unique = recordClass.isUnique(recordClassIndex);
    return DNSQuestion.newQuestion(domain, type, recordClass, unique);
}
 
开发者ID:iilxy,项目名称:AndroidmDNS,代码行数:12,代码来源:DNSIncoming.java


示例20: Address

import javax.jmdns.impl.constants.DNSRecordClass; //导入依赖的package包/类
protected Address(String name, DNSRecordType type, DNSRecordClass recordClass, boolean unique, int ttl, byte[] rawAddress) {
    super(name, type, recordClass, unique, ttl);
    try {
        this._addr = InetAddress.getByAddress(rawAddress);
    } catch (UnknownHostException exception) {
        logger1.log(Level.WARNING, "Address() exception ", exception);
    }
}
 
开发者ID:iilxy,项目名称:AndroidmDNS,代码行数:9,代码来源:DNSRecord.java



注:本文中的javax.jmdns.impl.constants.DNSRecordClass类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ProgramRunnerUtil类代码示例发布时间:2022-05-22
下一篇:
Java MapStoreConfig类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap