Esempio n. 1
0
 void rrFromWire(DNSInput in) throws IOException {
   if (in.remaining() > 0) options = new ArrayList();
   while (in.remaining() > 0) {
     int code = in.readU16();
     int len = in.readU16();
     byte[] data = in.readByteArray(len);
     options.add(new Option(code, data));
   }
 }
Esempio n. 2
0
 /** Gets all options in the OPTRecord with a specific code. This returns a list of byte arrays. */
 public List getOptions(int code) {
   if (options == null) return Collections.EMPTY_LIST;
   List list = null;
   for (Iterator it = options.iterator(); it.hasNext(); ) {
     Option opt = (Option) it.next();
     if (opt.code == code) {
       if (list == null) list = new ArrayList();
       list.add(opt.data);
     }
   }
   if (list == null) return Collections.EMPTY_LIST;
   return list;
 }