/** * Determines if two Records are identical. This compares the name, type, * class, and rdata (with names canonicalized). The TTLs are not compared. * @param arg The record to compare to * @return true if the records are equal, false otherwise. */ public boolean equals(Object arg) { if (arg == null || !(arg instanceof Record)) return false; Record r = (Record) arg; if (type != r.type || dclass != r.dclass || !name.equals(r.name)) return false; byte [] array1 = rdataToWireCanonical(); byte [] array2 = r.rdataToWireCanonical(); return Arrays.equals(array1, array2); }
/** * Determines if two Records are identical. This compares the name, type, * class, and rdata (with names canonicalized). The TTLs are not compared. * @param arg The record to compare to * @return true if the records are equal, false otherwise. */ public boolean equals(Object arg) { if (arg == null || !(arg instanceof Record)) return false; Record r = (Record) arg; if (type != r.type || dclass != r.dclass || !name.equals(r.name)) return false; byte [] array1 = rdataToWireCanonical(); byte [] array2 = r.rdataToWireCanonical(); return Arrays.equals(array1, array2); }
/** * Determines if two Records are identical. This compares the name, type, * class, and rdata (with names canonicalized). The TTLs are not compared. * @param arg The record to compare to * @return true if the records are equal, false otherwise. */ public boolean equals(Object arg) { if (arg == null || !(arg instanceof Record)) return false; Record r = (Record) arg; if (type != r.type || dclass != r.dclass || !name.equals(r.name)) return false; byte [] array1 = rdataToWireCanonical(); byte [] array2 = r.rdataToWireCanonical(); return Arrays.equals(array1, array2); }
/** * Determines if two Records are identical. This compares the name, type, * class, and rdata (with names canonicalized). The TTLs are not compared. * @param arg The record to compare to * @return true if the records are equal, false otherwise. */ public boolean equals(Object arg) { if (arg == null || !(arg instanceof Record)) return false; Record r = (Record) arg; if (type != r.type || dclass != r.dclass || !name.equals(r.name)) return false; byte [] array1 = rdataToWireCanonical(); byte [] array2 = r.rdataToWireCanonical(); return Arrays.equals(array1, array2); }
if (n != 0) return (n); byte [] rdata1 = rdataToWireCanonical(); byte [] rdata2 = arg.rdataToWireCanonical(); for (int i = 0; i < rdata1.length && i < rdata2.length; i++) { n = (rdata1[i] & 0xFF) - (rdata2[i] & 0xFF);
if (n != 0) return (n); byte [] rdata1 = rdataToWireCanonical(); byte [] rdata2 = arg.rdataToWireCanonical(); for (int i = 0; i < rdata1.length && i < rdata2.length; i++) { n = (rdata1[i] & 0xFF) - (rdata2[i] & 0xFF);
if (n != 0) return (n); byte [] rdata1 = rdataToWireCanonical(); byte [] rdata2 = arg.rdataToWireCanonical(); for (int i = 0; i < rdata1.length && i < rdata2.length; i++) { n = (rdata1[i] & 0xFF) - (rdata2[i] & 0xFF);
if (n != 0) return (n); byte [] rdata1 = rdataToWireCanonical(); byte [] rdata2 = arg.rdataToWireCanonical(); for (int i = 0; i < rdata1.length && i < rdata2.length; i++) { n = (rdata1[i] & 0xFF) - (rdata2[i] & 0xFF);
/** * Converts a raw wire transfer format of a record to a DNS record. * @param data The raw byte stream of a record in wire transfer format. * @return A DNSRecord converted from the wire format. * @throws IOException */ public static DNSRecord fromWire(byte[] data) throws IOException { Record rec = Record.fromWire(data, Section.ANSWER); DNSRecord retVal = new DNSRecord(); retVal.setDclass(rec.getDClass()); retVal.setName(rec.getName().toString()); retVal.setData(rec.rdataToWireCanonical()); retVal.setTtl(rec.getTTL()); retVal.setType(rec.getType()); return retVal; } }
/** * Converts a raw wire transfer format of a record to a DNS record. * @param data The raw byte stream of a record in wire transfer format. * @return A DNSRecord converted from the wire format. * @throws IOException */ public static DNSRecord fromWire(byte[] data) throws IOException { Record rec = Record.fromWire(data, Section.ANSWER); DNSRecord retVal = new DNSRecord(); retVal.setDclass(rec.getDClass()); retVal.setName(rec.getName().toString()); retVal.setData(rec.rdataToWireCanonical()); retVal.setTtl(rec.getTTL()); retVal.setType(rec.getType()); return retVal; } }
int lengthPosition = out.current(); out.writeU16(0); out.writeByteArray(records[i].rdataToWireCanonical()); int rrlength = out.current() - lengthPosition - 2; out.save();
int lengthPosition = out.current(); out.writeU16(0); out.writeByteArray(records[i].rdataToWireCanonical()); int rrlength = out.current() - lengthPosition - 2; out.save();
int lengthPosition = out.current(); out.writeU16(0); out.writeByteArray(records[i].rdataToWireCanonical()); int rrlength = out.current() - lengthPosition - 2; out.save();