/*
 * @(#)CanonicalName.java
 *
 * Copyright (c) 2001-2002 JScape
 * 1147 S. 53rd Pl., Mesa, Arizona, 85206, U.S.A.
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of
 * JScape. ("Confidential Information").  You shall not disclose such
 * Confidential Information and shall use it only in accordance with
 * the terms of the license agreement you entered into with JScape.
 */

package com.jscape.inet.dns.record;


import com.jscape.inet.dns.DnsInputStream;

import java.io.IOException;


/**
 * CanonicalName record specifies the canonical or primary name for the
 * owner of a domain name.
 */
public class CanonicalName
        extends DnsRecord {
    private String canonicalName;

    protected void decode(DnsInputStream inputStream)
            throws IOException {
        canonicalName = inputStream.readDomainName();
    }

    /**
     * Gets canonical name for domain name.
     *
     * @return canonical name
     */
    public String getCanonicalName() {
        return canonicalName;
    }

    /**
     * Gets String representation of this record.
     *
     * @return String
     */
    public String toString() {
        return getRecordName() + "\tcanonical name = " + canonicalName;
    }
}

