MCPcopy Create free account
hub / github.com/DeNA/PacketProxy / fromString

Method fromString

src/main/java/core/org/xbill/DNS/Record.java:445–478  ·  view source on GitHub ↗

Builds a new Record from its textual representation @param name The owner name of the record. @param type The record's type. @param dclass The record's class. @param ttl The record's time to live. @param st A tokenizer containing the textual representation of the rdata. @param origin The default ori

(Name name, int type, int dclass, long ttl, Tokenizer st, Name origin)

Source from the content-addressed store, hash-verified

443 * @throws IOException The text format was invalid.
444 */
445public static Record
446fromString(Name name, int type, int dclass, long ttl, Tokenizer st, Name origin)
447throws IOException
448{
449 Record rec;
450
451 if (!name.isAbsolute())
452 throw new RelativeNameException(name);
453 Type.check(type);
454 DClass.check(dclass);
455 TTL.check(ttl);
456
457 Tokenizer.Token t = st.get();
458 if (t.type == Tokenizer.IDENTIFIER && t.value.equals("\\#")) {
459 int length = st.getUInt16();
460 byte [] data = st.getHex();
461 if (data == null) {
462 data = new byte[0];
463 }
464 if (length != data.length)
465 throw st.exception("invalid unknown RR encoding: " +
466 "length mismatch");
467 DNSInput in = new DNSInput(data);
468 return newRecord(name, type, dclass, ttl, length, in);
469 }
470 st.unget();
471 rec = getEmptyRecord(name, type, dclass, ttl, true);
472 rec.rdataFromString(st, origin);
473 t = st.get();
474 if (t.type != Tokenizer.EOL && t.type != Tokenizer.EOF) {
475 throw st.exception("unexpected tokens at end of record");
476 }
477 return rec;
478}
479
480/**
481 * Builds a new Record from its textual representation

Callers 6

presentMethod · 0.95
addMethod · 0.95
deleteMethod · 0.95
_nextRecordMethod · 0.95
nextRecordMethod · 0.95
expandMethod · 0.95

Calls 13

checkMethod · 0.95
checkMethod · 0.95
checkMethod · 0.95
newRecordMethod · 0.95
getEmptyRecordMethod · 0.95
rdataFromStringMethod · 0.95
isAbsoluteMethod · 0.80
getUInt16Method · 0.80
getHexMethod · 0.80
exceptionMethod · 0.80
ungetMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected