public abstract class Record extends Object implements Cloneable, Comparable, Serializable
| Modifier | Constructor and Description |
|---|---|
protected |
Record() |
| Modifier and Type | Method and Description |
|---|---|
protected static byte[] |
byteArrayFromString(String s)
Converts a String into a byte array.
|
protected static String |
byteArrayToString(byte[] array,
boolean quote)
Converts a byte array into a String.
|
static byte[] |
checkByteArrayLength(String field,
byte[] array,
int maxLength) |
static int |
checkU16(String field,
int val) |
static long |
checkU32(String field,
long val) |
Record |
cloneRecord() |
int |
compareTo(Object o)
Compares this Record to another Object.
|
boolean |
equals(Object arg)
Determines if two Records are identical.
|
static Record |
fromString(Name name,
int type,
int dclass,
long ttl,
String s,
Name origin)
Builds a new Record from its textual representation
|
static Record |
fromString(Name name,
int type,
int dclass,
long ttl,
Tokenizer st,
Name origin)
Builds a new Record from its textual representation
|
static Record |
fromWire(byte[] b,
int section)
Builds a Record from DNS uncompressed wire format.
|
static Record |
fromWire(DNSInput in,
int section,
boolean isUpdate) |
Name |
getAdditionalName()
Returns the name for which additional data processing should be done for
this record.
|
int |
getDClass()
Returns the record's class
|
Name |
getName()
Returns the record's name
|
int |
getRRsetType()
Returns the type of RRset that this record would belong to.
|
long |
getTTL()
Returns the record's TTL
|
int |
getType()
Returns the record's type
|
int |
hashCode()
Generates a hash code based on the Record's data.
|
static Record |
newRecord(Name name,
int type,
int dclass)
Creates a new empty record, with the given parameters.
|
static Record |
newRecord(Name name,
int type,
int dclass,
long ttl)
Creates a new empty record, with the given parameters.
|
static Record |
newRecord(Name name,
int type,
int dclass,
long ttl,
byte[] data)
Creates a new record, with the given parameters.
|
static Record |
newRecord(Name name,
int type,
int dclass,
long ttl,
int length,
byte[] data)
Creates a new record, with the given parameters.
|
String |
rdataToString()
Converts the rdata portion of a Record into a String representation
|
byte[] |
rdataToWireCanonical()
Converts the rdata in a Record into canonical DNS uncompressed wire
format (all names are converted to lowercase).
|
boolean |
sameRRset(Record rec)
Determines if two Records could be part of the same RRset.
|
void |
setTTL(long ttl) |
String |
toString()
Converts a Record into a String representation
|
void |
toWire(DNSOutput out,
int section,
Compression c) |
byte[] |
toWire(int section)
Converts a Record into DNS uncompressed wire format.
|
byte[] |
toWireCanonical()
Converts a Record into canonical DNS uncompressed wire format (all names
are converted to lowercase).
|
protected static String |
unknownToString(byte[] data)
Converts a byte array into the unknown RR format.
|
Record |
withDClass(int dclass,
long ttl)
Creates a new record identical to the current record, but with a
different class and ttl.
|
Record |
withName(Name name)
Creates a new record identical to the current record, but with a
different name.
|
public Name name
public int type
public int dclass
public long ttl
public static Record newRecord(Name name, int type, int dclass, long ttl, int length, byte[] data)
name - The owner name of the record.type - The record's type.dclass - The record's class.ttl - The record's time to live.length - The length of the record's data.data - The rdata of the record, in uncompressed DNS wire format.
Only the first length bytes are used.public static Record newRecord(Name name, int type, int dclass, long ttl, byte[] data)
name - The owner name of the record.type - The record's type.dclass - The record's class.ttl - The record's time to live.data - The complete rdata of the record, in uncompressed DNS wire
format.public static Record newRecord(Name name, int type, int dclass, long ttl)
name - The owner name of the record.type - The record's type.dclass - The record's class.ttl - The record's time to live.public static Record newRecord(Name name, int type, int dclass)
name - The owner name of the record.type - The record's type.dclass - The record's class.public static Record fromWire(DNSInput in, int section, boolean isUpdate) throws IOException
IOExceptionpublic static Record fromWire(byte[] b, int section) throws IOException
IOExceptionpublic void toWire(DNSOutput out, int section, Compression c)
public byte[] toWire(int section)
public byte[] toWireCanonical()
public byte[] rdataToWireCanonical()
public String rdataToString()
public String toString()
protected static byte[] byteArrayFromString(String s) throws TextParseException
TextParseExceptionprotected static String byteArrayToString(byte[] array, boolean quote)
protected static String unknownToString(byte[] data)
public static Record fromString(Name name, int type, int dclass, long ttl, Tokenizer st, Name origin) throws IOException
name - The owner name of the record.type - The record's type.dclass - The record's class.ttl - The record's time to live.st - A tokenizer containing the textual representation of the rdata.origin - The default origin to be appended to relative domain names.IOException - The text format was invalid.public static Record fromString(Name name, int type, int dclass, long ttl, String s, Name origin) throws IOException
name - The owner name of the record.type - The record's type.dclass - The record's class.ttl - The record's time to live.s - The textual representation of the rdata.origin - The default origin to be appended to relative domain names.IOException - The text format was invalid.public int getType()
Typepublic int getRRsetType()
public int getDClass()
public long getTTL()
public boolean sameRRset(Record rec)
public boolean equals(Object arg)
public int hashCode()
public Record cloneRecord()
public Record withName(Name name)
public Record withDClass(int dclass, long ttl)
public void setTTL(long ttl)
public int compareTo(Object o)
compareTo in interface Comparableo - The Object to be compared.ClassCastException - if the argument is not a Record.public Name getAdditionalName()
public static int checkU16(String field, int val)
public static long checkU32(String field, long val)
public static byte[] checkByteArrayLength(String field, byte[] array, int maxLength)
Copyright © 2021 McEvoy Software Ltd. All rights reserved.