diff options
author | Rene Treffer <treffer@measite.de> | 2014-04-02 22:00:32 +0200 |
---|---|---|
committer | Rene Treffer <treffer@measite.de> | 2014-04-02 22:00:32 +0200 |
commit | 32b27c53e03d3e1f25230efc48610efeab31f9a2 (patch) | |
tree | 89b60b17670b098cbb476b855c8fbe430a2edb80 /src/de/measite/minidns/record/A.java |
Initial commit
Diffstat (limited to 'src/de/measite/minidns/record/A.java')
-rw-r--r-- | src/de/measite/minidns/record/A.java | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/de/measite/minidns/record/A.java b/src/de/measite/minidns/record/A.java new file mode 100644 index 00000000..a85a7af0 --- /dev/null +++ b/src/de/measite/minidns/record/A.java @@ -0,0 +1,37 @@ +package de.measite.minidns.record; + +import java.io.DataInputStream; +import java.io.IOException; + +import de.measite.minidns.Record.TYPE; + +public class A implements Data { + + private byte[] ip; + + @Override + public TYPE getType() { + return TYPE.A; + } + + @Override + public byte[] toByteArray() { + return ip; + } + + @Override + public void parse(DataInputStream dis, byte[] data, int length) + throws IOException { + ip = new byte[4]; + dis.readFully(ip); + } + + @Override + public String toString() { + return Integer.toString(ip[0] & 0xff) + "." + + Integer.toString(ip[1] & 0xff) + "." + + Integer.toString(ip[2] & 0xff) + "." + + Integer.toString(ip[3] & 0xff); + } + +} |