Data.java

 1package de.measite.minidns.record;
 2
 3import java.io.DataInputStream;
 4import java.io.IOException;
 5
 6import de.measite.minidns.Record.TYPE;
 7
 8/**
 9 * Generic payload class.
10 */
11public interface Data {
12
13    /**
14     * The payload type.
15     * @return The payload type.
16     */
17    TYPE getType();
18
19    /**
20     * Binary representation of this payload.
21     * @return The binary representation of this payload.
22     */
23    byte[] toByteArray();
24
25    /**
26     * Parse this payload.
27     * @param dis The input stream.
28     * @param data The plain data (needed for name cross references).
29     * @param length The payload length.
30     * @throws IOException on io error (read past paket boundary).
31     */
32    void parse(DataInputStream dis, byte data[], int length) throws IOException;
33
34}