Class DomainName

java.lang.Object
net.handle.dnslib.DomainName

public class DomainName extends Object
  • Field Details

  • Constructor Details

    • DomainName

      public DomainName(byte[][] labels)
  • Method Details

    • getLabels

      public byte[][] getLabels()
      Return a byte array of labels
    • toString

      public String toString()
      Returns an ASCII string as would appear in a master file.
      Overrides:
      toString in class Object
    • ofString

      public static DomainName ofString(String s) throws ParseException
      Parses an UTF8 string as would appear in a IDN-capable master file; it does NOT create hx-- labels
      Throws:
      ParseException
    • isHexByte

      public static final boolean isHexByte(byte ch1, byte ch2)
    • decodeHexByte

      public static final byte decodeHexByte(byte ch1, byte ch2)
    • toHandle

      public byte[] toHandle(String handlePrefix, int lengthOfAssumedDomain) throws ParseException
      Converts to handle, using IDNA (xn--), as well as hx-- encoding (which is like percent encoding only it uses hyphen). Order is reversed and '/' is used as separator in place of '.'
      Throws:
      ParseException
    • parent

      public DomainName parent()
    • ancestorChildOf

      public DomainName ancestorChildOf(DomainName name)
      Assumes name is already an ancestor of this; returns the child of name that is also an ancestor of this
    • descendsFrom

      public boolean descendsFrom(DomainName ancestor)
    • asteriskLabelSibling

      public DomainName asteriskLabelSibling()
    • length

      public int length()
    • parseWire

      public static DomainName parseWire(byte[] wire, int[] offsetArr) throws ParseException
      Returns a DomainName and changes the offset stored in offsetArr[0]
      Throws:
      ParseException
    • appendToWireWithCompression

      public int appendToWireWithCompression(OutputStream wire, int offset, Map<DomainName,Integer> compressionTable) throws IOException
      Throws:
      IOException
    • appendToWireWithCompression

      public int appendToWireWithCompression(OutputStream wire, int offset, Map<DomainName,Integer> compressionTable, boolean compress) throws IOException
      Throws:
      IOException
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object