Exemplo n.º 1
0
 /**
  * Gets the next token from a tokenizer and converts it to a name.
  *
  * @param origin The origin to append to relative names.
  * @return The next token in the stream, as a name.
  * @throws TextParseException The input was invalid or not a valid name.
  * @throws IOException An I/O error occurred.
  * @throws RelativeNameException The parsed name was relative, even with the origin.
  * @see Name
  */
 public Name getName(Name origin) throws IOException {
   try {
     Name name = Name.fromString(getIdentifier(), origin);
     if (!name.isAbsolute()) throw new RelativeNameException(name);
     return name;
   } catch (TextParseException e) {
     throw exception(e.getMessage());
   }
 }
Exemplo n.º 2
0
 void rdataFromString(Tokenizer st, Name origin) throws IOException {
   order = st.getUInt16();
   preference = st.getUInt16();
   try {
     flags = byteArrayFromString(st.getString());
     service = byteArrayFromString(st.getString());
     regexp = byteArrayFromString(st.getString());
   } catch (TextParseException e) {
     throw st.exception(e.getMessage());
   }
   replacement = st.getName(origin);
 }
Exemplo n.º 3
0
 /**
  * Creates an NAPTR Record from the given data
  *
  * @param order The order of this NAPTR. Records with lower order are preferred.
  * @param preference The preference, used to select between records at the same order.
  * @param flags The control aspects of the NAPTRRecord.
  * @param service The service or protocol available down the rewrite path.
  * @param regexp The regular/substitution expression.
  * @param replacement The domain-name to query for the next DNS resource record, depending on the
  *     value of the flags field.
  * @throws IllegalArgumentException One of the strings has invalid escapes
  */
 public NAPTRRecord(
     Name name,
     int dclass,
     long ttl,
     int order,
     int preference,
     String flags,
     String service,
     String regexp,
     Name replacement) {
   super(name, Type.NAPTR, dclass, ttl);
   this.order = checkU16("order", order);
   this.preference = checkU16("preference", preference);
   try {
     this.flags = byteArrayFromString(flags);
     this.service = byteArrayFromString(service);
     this.regexp = byteArrayFromString(regexp);
   } catch (TextParseException e) {
     throw new IllegalArgumentException(e.getMessage());
   }
   this.replacement = checkName("replacement", replacement);
 }