/*
 * @(#)Null.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;


/**
 * Null record may contain any data.
 */
public class Null
        extends DnsRecord {
    private byte[] data;
    private String text;

    protected void decode(DnsInputStream inputStream)
            throws IOException {
        data = new byte[inputStream.available()];
        inputStream.read(data);
        text = new String(data, "latin1");
    }

    /**
     * Gets any data in this record sol long as it is 65535 octets or less.
     *
     * @return data
     */
    public byte[] getNullData() {
        byte[] copy = new byte[data.length];

        System.arraycopy(data, 0, copy, 0, data.length);
        return copy;
    }

    /**
     * Gets String representation of this record.
     *
     * @return String
     */
    public String toString() {
        return getRecordName() + "\tnull data = [" + text + ']';
    }
}

