本文整理匯總了Java中org.xbill.DNS.Type.value方法的典型用法代碼示例。如果您正苦於以下問題:Java Type.value方法的具體用法?Java Type.value怎麽用?Java Type.value使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.xbill.DNS.Type
的用法示例。
在下文中一共展示了Type.value方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: process
import org.xbill.DNS.Type; //導入方法依賴的package包/類
@Override
public void process(Exchange exchange) throws Exception {
String dnsName = exchange.getIn().getHeader(DnsConstants.DNS_NAME, String.class);
ObjectHelper.notEmpty(dnsName, "Header " + DnsConstants.DNS_NAME);
Object type = exchange.getIn().getHeader(DnsConstants.DNS_TYPE);
Integer dnsType = null;
if (type != null) {
dnsType = Type.value(String.valueOf(type));
}
Object dclass = exchange.getIn().getHeader(DnsConstants.DNS_CLASS);
Integer dnsClass = null;
if (dclass != null) {
dnsClass = DClass.value(String.valueOf(dclass));
}
Lookup lookup = (dnsClass == null)
? (dnsType == null ? new Lookup(dnsName) : new Lookup(dnsName, dnsType))
: new Lookup(dnsName, dnsType, dnsClass);
lookup.run();
if (lookup.getAnswers() != null) {
exchange.getIn().setBody(lookup.getAnswers());
} else {
throw new CamelException(lookup.getErrorString());
}
}
示例2: process
import org.xbill.DNS.Type; //導入方法依賴的package包/類
@Override
public void process(Exchange exchange) throws Exception {
String server = exchange.getIn().getHeader(DnsConstants.DNS_SERVER, String.class);
SimpleResolver resolver = new SimpleResolver(server);
int type = Type.value(exchange.getIn().getHeader(DnsConstants.DNS_TYPE, String.class));
if (type == -1) {
// default: if unparsable value given, use A.
type = Type.A;
}
String dclassValue = exchange.getIn().getHeader(DnsConstants.DNS_CLASS, String.class);
if (dclassValue == null) {
dclassValue = "";
}
int dclass = DClass.value(dclassValue);
if (dclass == -1) {
// by default, value is IN.
dclass = DClass.IN;
}
Name name = Name.fromString(exchange.getIn().getHeader(DnsConstants.DNS_NAME, String.class), Name.root);
Record rec = Record.newRecord(name, type, dclass);
Message query = Message.newQuery(rec);
Message response = resolver.send(query);
exchange.getIn().setBody(response);
}
示例3: parseQuestion
import org.xbill.DNS.Type; //導入方法依賴的package包/類
private Record parseQuestion(String line) throws TextParseException {
String[] temp = line.replaceAll("\\s+", " ").split(" ");
if (Type.value(temp[2]) == -1) {
System.out.println(temp[2]);
}
return Record.newRecord(Name.fromString(temp[0]), Type.value(temp[2]), DClass.value(temp[1]));
}
示例4: onItemSelected
import org.xbill.DNS.Type; //導入方法依賴的package包/類
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
String selected = (String) (((Spinner) findViewById(R.id.spinnerKnownTypes))).getSelectedItem();
String selectedNumber = "" + Type.value(selected);
(((EditText) findViewById(R.id.txtQTYPE))).setText(selectedNumber);
}
示例5: DNSLookupEntry
import org.xbill.DNS.Type; //導入方法依賴的package包/類
public DNSLookupEntry(String name, String type) throws TextParseException{
this(name, Type.value(type));
}