public abstract class Record extends Object implements Cloneable, Comparable<Record>, Serializable
Modifier and Type | Field and Description |
---|---|
protected int |
dclass |
protected Name |
name |
protected long |
ttl |
protected int |
type |
Modifier | Constructor and Description |
---|---|
protected |
Record() |
protected |
Record(Name name,
int type,
int dclass,
long ttl) |
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.
|
int |
compareTo(Record arg)
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.
|
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.
|
protected abstract void |
rdataFromString(Tokenizer st,
Name origin)
Converts the text format of an RR to the internal format - must be overriden
|
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).
|
protected abstract void |
rrFromWire(DNSInput in)
Converts the type-specific RR to wire format - must be overridden
|
protected abstract String |
rrToString()
Converts the type-specific RR to text format - must be overridden.
|
protected abstract void |
rrToWire(DNSOutput out,
Compression c,
boolean canonical)
Converts the type-specific RR to wire format - must be overridden.
|
boolean |
sameRRset(Record rec)
Determines if two Records could be part of the same RRset.
|
String |
toString()
Converts a Record into a String representation
|
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 |
withName(Name name)
Creates a new record identical to the current record, but with a different name.
|
protected Name name
protected int type
protected int dclass
protected long ttl
protected Record()
protected Record(Name name, int type, int dclass, long ttl)
protected abstract void rrFromWire(DNSInput in) throws IOException
IOException
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(byte[] b, int section) throws IOException
IOException
public byte[] toWire(int section)
public byte[] toWireCanonical()
public byte[] rdataToWireCanonical()
protected abstract String rrToString()
public String rdataToString()
public String toString()
protected abstract void rdataFromString(Tokenizer st, Name origin) throws IOException
IOException
protected static byte[] byteArrayFromString(String s) throws TextParseException
TextParseException
protected 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()
Type
public int getRRsetType()
public int getDClass()
public long getTTL()
protected abstract void rrToWire(DNSOutput out, Compression c, boolean canonical)
public boolean sameRRset(Record rec)
public boolean equals(Object arg)
public int hashCode()
public Record withName(Name name)
public int compareTo(Record arg)
compareTo
in interface Comparable<Record>
arg
- The Object to be compared.ClassCastException
- if the argument is not a Record.public Name getAdditionalName()
Copyright © 2023 dnsjava.org. All rights reserved.