Java Code Examples for org.xbill.DNS.Type#string()
The following examples show how to use
org.xbill.DNS.Type#string() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DNSFormActivity.java From androdns with Apache License 2.0 | 6 votes |
@Override public void onFocusChange(View view, boolean hasFocus) { EditText txtQtype = (((EditText) findViewById(R.id.txtQTYPE))); Spinner spKnownTypes = (Spinner) findViewById(R.id.spinnerKnownTypes); // set spinner qtype from number if (view == txtQtype && !hasFocus) { try { int qtype = gettxtQTYPEContent(); String qnameString = Type.string(qtype); int ind = getIndex(spKnownTypes, qnameString, -1); if (ind > -1) { spKnownTypes.setSelection(ind); } } catch (Exception e) { } } updateBookmarkImageState(); }
Example 2
Source File: DNS.java From openemm with GNU Affero General Public License v3.0 | 5 votes |
private String typeString (int type) { try { return Type.string (type); } catch (InvalidTypeException e) { return "" + type; } }
Example 3
Source File: DNSFormActivity.java From androdns with Apache License 2.0 | 5 votes |
private void fillQTypes() { // List<String> spinnerArray = new ArrayList<String>(); ArrayAdapter<String> adapter = new ArrayAdapter<String>( this, android.R.layout.simple_spinner_item, spinnerArray); for (int i = 1; i <= 32769; i++) { String textual = Type.string(i); if (textual != null && !textual.startsWith("TYPE")) { spinnerArray.add(textual); } } Collections.sort(spinnerArray); (((Spinner) findViewById(R.id.spinnerKnownTypes))).setAdapter(adapter); }
Example 4
Source File: BookmarkedQueriesAdapter.java From androdns with Apache License 2.0 | 4 votes |
@Override public View getView(int position, View convertView, ViewGroup parent) { LayoutInflater inflater = (LayoutInflater) context .getSystemService(Context.LAYOUT_INFLATER_SERVICE); View rowView = inflater.inflate(R.layout.sessiondisplay_bookmark, parent, false); Session session = values[position]; String qname = session.qname; if (!session.server.equals("")){ qname = qname+"@"+session.server; } if(!session.isDefaultPort()){ qname = qname+":"+session.port; } ((TextView) rowView.findViewById(R.id.bookmarked_qname)).setText(qname); String type = ""+session.qtype; try { String txtType = Type.string(session.qtype); if (!type.equals(txtType)) { type = type + "(" + txtType + ")"; } } catch (InvalidTypeException e) {} ((TextView) rowView.findViewById(R.id.bookmarked_qtype)).setText(type); StringBuffer flagsBuffer = new StringBuffer(); // add proto to flags view if not DNS if (!session.protocol.equalsIgnoreCase("DNS")){ flagsBuffer.append(session.protocol); flagsBuffer.append(" "); } // add qclass to flags view if not IN if (!session.qclass.equalsIgnoreCase("IN")){ flagsBuffer.append(session.qclass); flagsBuffer.append(" "); } if (session.flag_RD){ flagsBuffer.append("RD "); } if (session.flag_CD){ flagsBuffer.append("CD "); } if(session.flag_DO){ flagsBuffer.append("DO "); } if(session.TCP && session.protocol.equalsIgnoreCase("DNS")){ flagsBuffer.append("TCP "); } ((TextView) rowView.findViewById(R.id.bookmarked_flags)).setText(flagsBuffer.toString()); return rowView; }
Example 5
Source File: HistoryAdapter.java From androdns with Apache License 2.0 | 4 votes |
@Override public View getView(int position, View convertView, ViewGroup parent) { LayoutInflater inflater = (LayoutInflater) context .getSystemService(Context.LAYOUT_INFLATER_SERVICE); View rowView = inflater.inflate(R.layout.sessiondisplay_history, parent, false); Session session = values[position]; TextView dateView = (TextView) rowView.findViewById(R.id.history_entry_date); dateView.setText(getDate(session.answer.runtimestamp, "yyyy-MM-dd hh:mm:ss")); String qname = session.qname; if (!session.server.equals("")){ qname = qname+"@"+session.server; } if(!session.isDefaultPort()){ qname = qname+":"+session.port; } ((TextView) rowView.findViewById(R.id.history_qname)).setText(qname); String type = ""+session.qtype; try { String txtType = Type.string(session.qtype); if (!type.equals(txtType)) { type = type + "(" + txtType + ")"; } } catch (InvalidTypeException e) {} ((TextView) rowView.findViewById(R.id.history_qtype)).setText(type); StringBuffer flagsBuffer = new StringBuffer(); // add proto to flags view if not DNS if (!session.protocol.equalsIgnoreCase("DNS")){ flagsBuffer.append(session.protocol); flagsBuffer.append(" "); } // add qclass to flags view if not IN if (!session.qclass.equalsIgnoreCase("IN")){ flagsBuffer.append(session.qclass); flagsBuffer.append(" "); } if (session.flag_RD){ flagsBuffer.append("RD "); } if (session.flag_CD){ flagsBuffer.append("CD "); } if(session.flag_DO){ flagsBuffer.append("DO "); } if(session.TCP && session.protocol.equalsIgnoreCase("DNS")){ flagsBuffer.append("TCP "); } ((TextView) rowView.findViewById(R.id.history_flags)).setText(flagsBuffer.toString()); return rowView; }