
com.kendamasoft.dns.records.ARecord Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of dns-client Show documentation
Show all versions of dns-client Show documentation
Compact DNS client library intended primary for network utilities and testing applications
package com.kendamasoft.dns.records;
import com.kendamasoft.dns.Buffer;
import com.kendamasoft.dns.Record;
/**
* IPv4 address record
*/
public class ARecord extends Record {
final byte[] address = new byte[4];
@Override
public void parseData(short dataLength, Buffer buffer) {
for(int i=0; i<4; i++) {
address[i] = buffer.readByte();
}
}
public byte[] getAddress() {
return address;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
for(byte b : address) {
sb.append(b & 0xff).append(".");
}
sb.delete(sb.length() - 1, sb.length());
return "A " + sb.toString();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy