public String toString() { StringBuffer sb = new StringBuffer(); for (Iterator it = types.iterator(); it.hasNext(); ) { int t = ((Integer)it.next()).intValue(); sb.append(Type.string(t)); if (it.hasNext()) sb.append(' '); } return sb.toString(); }
/** * Converts a String representation of an Type into its numeric value * @return The type code, or -1 on error. */ public static int value(String s) { return value(s, false); }
/** * Indicates whether generation is supported for this type. * @throws InvalidTypeException The type is out of range. */ public static boolean supportedType(int type) { Type.check(type); return (type == Type.PTR || type == Type.CNAME || type == Type.DNAME || type == Type.A || type == Type.AAAA || type == Type.NS); }
/** * Adds a record to the Cache. * @param r The record to be added * @param cred The credibility of the record * @param o The source of the record (this could be a Message, for example) * @see Record */ public synchronized void addRecord(Record r, int cred, Object o) { Name name = r.getName(); int type = r.getRRsetType(); if (!Type.isRR(type)) return; Element element = findElement(name, type, cred); if (element == null) { CacheRRset crrset = new CacheRRset(r, cred, maxcache); addRRset(crrset, cred); } else if (element.compareCredibility(cred) == 0) { if (element instanceof CacheRRset) { CacheRRset crrset = (CacheRRset) element; crrset.addRR(r); } } }
private static final Record getEmptyRecord(Name name, int type, int dclass, long ttl, boolean hasData) { Record proto, rec; if (hasData) { proto = Type.getProto(type); if (proto != null) rec = proto.getObject(); else rec = new UNKRecord(); } else rec = new EmptyRecord(); rec.name = name; rec.type = type; rec.dclass = dclass; rec.ttl = ttl; return rec; }
/** * Adds a record to the Cache. * @param r The record to be added * @param cred The credibility of the record * @param o The source of the record (this could be a Message, for example) * @see Record */ public synchronized void addRecord(Record r, int cred, Object o) { Name name = r.getName(); int type = r.getRRsetType(); if (!Type.isRR(type)) return; Element element = findElement(name, type, cred); if (element == null) { CacheRRset crrset = new CacheRRset(r, cred, maxcache); addRRset(crrset, cred); } else if (element.compareCredibility(cred) == 0) { if (element instanceof CacheRRset) { CacheRRset crrset = (CacheRRset) element; crrset.addRR(r); } } }
private static final Record getEmptyRecord(Name name, int type, int dclass, long ttl, boolean hasData) { Record proto, rec; if (hasData) { proto = Type.getProto(type); if (proto != null) rec = proto.getObject(); else rec = new UNKRecord(); } else rec = new EmptyRecord(); rec.name = name; rec.type = type; rec.dclass = dclass; rec.ttl = ttl; return rec; }
public String toString() { StringBuffer sb = new StringBuffer(); if (type == 0) sb.append("NXDOMAIN " + name); else sb.append("NXRRSET " + name + " " + Type.string(type)); sb.append(" cl = "); sb.append(credibility); return sb.toString(); } }
/** * Converts a String representation of an Type into its numeric value * @return The type code, or -1 on error. */ public static int value(String s) { return value(s, false); }
/** * Adds a record to the Cache. * @param r The record to be added * @param cred The credibility of the record * @param o The source of the record (this could be a Message, for example) * @see Record */ public synchronized void addRecord(Record r, int cred, Object o) { Name name = r.getName(); int type = r.getRRsetType(); if (!Type.isRR(type)) return; Element element = findElement(name, type, cred); if (element == null) { CacheRRset crrset = new CacheRRset(r, cred, maxcache); addRRset(crrset, cred); } else if (element.compareCredibility(cred) == 0) { if (element instanceof CacheRRset) { CacheRRset crrset = (CacheRRset) element; crrset.addRR(r); } } }
/** * Indicates whether generation is supported for this type. * @throws InvalidTypeException The type is out of range. */ public static boolean supportedType(int type) { Type.check(type); return (type == Type.PTR || type == Type.CNAME || type == Type.DNAME || type == Type.A || type == Type.AAAA || type == Type.NS); }
private static final Record getEmptyRecord(Name name, int type, int dclass, long ttl, boolean hasData) { Record proto, rec; if (hasData) { proto = Type.getProto(type); if (proto != null) rec = proto.getObject(); else rec = new UNKRecord(); } else rec = new EmptyRecord(); rec.name = name; rec.type = type; rec.dclass = dclass; rec.ttl = ttl; return rec; }
/** Converts rdata to a String */ String rrToString() { StringBuffer sb = new StringBuffer(); sb.append(next); for (int i = 0; i < types.length; i++) { sb.append(" "); sb.append(Type.string(types[i])); } return sb.toString(); }
/** * Converts a String representation of an Type into its numeric value * @return The type code, or -1 on error. */ public static int value(String s) { return value(s, false); }
/** * Adds a record to the Cache. * @param r The record to be added * @param cred The credibility of the record * @param o The source of the record (this could be a Message, for example) * @see Record */ public synchronized void addRecord(Record r, int cred, Object o) { Name name = r.getName(); int type = r.getRRsetType(); if (!Type.isRR(type)) return; Element element = findElement(name, type, cred); if (element == null) { CacheRRset crrset = new CacheRRset(r, cred, maxcache); addRRset(crrset, cred); } else if (element.compareCredibility(cred) == 0) { if (element instanceof CacheRRset) { CacheRRset crrset = (CacheRRset) element; crrset.addRR(r); } } }
/** * Indicates whether generation is supported for this type. * @throws InvalidTypeException The type is out of range. */ public static boolean supportedType(int type) { Type.check(type); return (type == Type.PTR || type == Type.CNAME || type == Type.DNAME || type == Type.A || type == Type.AAAA || type == Type.NS); }