本文整理汇总了Java中javax.jmdns.impl.constants.DNSRecordClass类的典型用法代码示例。如果您正苦于以下问题:Java DNSRecordClass类的具体用法?Java DNSRecordClass怎么用?Java DNSRecordClass使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DNSRecordClass类属于javax.jmdns.impl.constants包,在下文中一共展示了DNSRecordClass类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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;
}
示例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);
}
}
示例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;
}
示例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;
}
示例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;
}
示例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();
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}