org.xbill.DNS
Class Name

java.lang.Object
  |
  +--org.xbill.DNS.Name

public class Name
extends Object

A representation of a domain name.


Field Summary
static Name root
          The root name
 
Constructor Summary
Name(DataByteInputStream in, org.xbill.DNS.Compression c)
          Create a new name from DNS wire format
Name(Name d, int n)
          Create a new name by removing labels from the beginning of an existing Name
Name(String s)
          Create a new name from a string
Name(String s, Name origin)
          Create a new name from a string and an origin
 
Method Summary
 void append(Name d)
          Appends the specified name to the end of the current Name
 boolean equals(Object arg)
          Are these two Names equivalent?
 int hashCode()
          Computes a hashcode based on the value
 boolean isQualified()
          Is this name fully qualified?
 boolean isWild()
          Is this name a wildcard?
 byte labels()
          The number of labels
 short length()
          The length
 boolean subdomain(Name domain)
          Is the current Name a subdomain of the specified name?
 String toString()
          Convert Name to a String
 void toWire(DataByteOutputStream out, org.xbill.DNS.Compression c)
          Convert Name to DNS wire format
 void toWireCanonical(DataByteOutputStream out)
          Convert Name to canonical DNS wire format (all lowercase)
 Name wild(int n)
          Generates a new Name with the first n labels replaced by a wildcard
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

root

public static Name root
The root name
Constructor Detail

Name

public Name(String s,
            Name origin)
Create a new name from a string and an origin
Parameters:
s - The string to be converted
origin - If the name is unqalified, the origin to be appended

Name

public Name(String s)
Create a new name from a string
Parameters:
s - The string to be converted

Name

public Name(DataByteInputStream in,
            org.xbill.DNS.Compression c)
     throws IOException
Create a new name from DNS wire format
Parameters:
in - A stream containing the input data
c - The compression context. This should be null unless a full message is being parsed.

Name

public Name(Name d,
            int n)
Create a new name by removing labels from the beginning of an existing Name
Parameters:
d - An existing Name
n - The number of labels to remove from the beginning in the copy
Method Detail

wild

public Name wild(int n)
Generates a new Name with the first n labels replaced by a wildcard
Returns:
The wildcard name

isWild

public boolean isWild()
Is this name a wildcard?

isQualified

public boolean isQualified()
Is this name fully qualified?

append

public void append(Name d)
Appends the specified name to the end of the current Name

length

public short length()
The length

labels

public byte labels()
The number of labels

subdomain

public boolean subdomain(Name domain)
Is the current Name a subdomain of the specified name?

toString

public String toString()
Convert Name to a String
Overrides:
toString in class Object

toWire

public void toWire(DataByteOutputStream out,
                   org.xbill.DNS.Compression c)
            throws IOException
Convert Name to DNS wire format

toWireCanonical

public void toWireCanonical(DataByteOutputStream out)
                     throws IOException
Convert Name to canonical DNS wire format (all lowercase)

equals

public boolean equals(Object arg)
Are these two Names equivalent?
Overrides:
equals in class Object

hashCode

public int hashCode()
Computes a hashcode based on the value
Overrides:
hashCode in class Object