public abstract class Record
extends java.lang.Object
implements java.lang.Cloneable, java.lang.Comparable, java.io.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() |
| Modifier and Type | Method and Description |
|---|---|
protected static byte[] |
byteArrayFromString(java.lang.String s)
Converts a String into a byte array.
|
protected static java.lang.String |
byteArrayToString(byte[] array,
boolean quote)
Converts a byte array into a String.
|
int |
compareTo(java.lang.Object o)
Compares this Record to another Object.
|
boolean |
equals(java.lang.Object arg)
Determines if two Records are identical.
|
static Record |
fromString(Name name,
int type,
int dclass,
long ttl,
java.lang.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.
|
java.lang.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.
|
java.lang.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 java.lang.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
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 java.io.IOException
java.io.IOExceptionpublic byte[] toWire(int section)
public byte[] toWireCanonical()
public byte[] rdataToWireCanonical()
public java.lang.String rdataToString()
public java.lang.String toString()
toString in class java.lang.Objectprotected static byte[] byteArrayFromString(java.lang.String s)
throws TextParseException
TextParseExceptionprotected static java.lang.String byteArrayToString(byte[] array,
boolean quote)
protected static java.lang.String unknownToString(byte[] data)
public static Record fromString(Name name, int type, int dclass, long ttl, Tokenizer st, Name origin) throws java.io.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.java.io.IOException - The text format was invalid.public static Record fromString(Name name, int type, int dclass, long ttl, java.lang.String s, Name origin) throws java.io.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.java.io.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(java.lang.Object arg)
equals in class java.lang.Objectarg - The record to compare topublic int hashCode()
hashCode in class java.lang.Objectpublic Record withName(Name name)
public int compareTo(java.lang.Object o)
compareTo in interface java.lang.Comparableo - The Object to be compared.java.lang.ClassCastException - if the argument is not a Record.public Name getAdditionalName()