Package de.measite.minidns
Class Question
- java.lang.Object
-
- de.measite.minidns.Question
-
public class Question extends java.lang.ObjectA DNS question (request).
-
-
Field Summary
Fields Modifier and Type Field Description private byte[]byteArrayCache for the serialized object.private Record.CLASSclazzThe question class (usually IN / internet).private java.lang.StringnameThe question string (e.g.private Record.TYPEtypeThe question type (e.g.private booleanunicastQueryUnicastQueries have the highest bit of the CLASS field set to 1.
-
Constructor Summary
Constructors Constructor Description Question(java.lang.String name, Record.TYPE type)Create a dns question for the given name/type/IN (internet class).Question(java.lang.String name, Record.TYPE type, Record.CLASS clazz)Create a dns question for the given name/type/class.Question(java.lang.String name, Record.TYPE type, Record.CLASS clazz, boolean unicastQuery)Create a dns question for the given name/type/class.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object other)Record.CLASSgetClazz()Retrieve the class of this dns question (usually internet).java.lang.StringgetName()Retrieve the name of this dns question (e.g.Record.TYPEgetType()Retrieve the type of this question.inthashCode()static Questionparse(java.io.DataInputStream dis, byte[] data)Parse a byte array and rebuild the dns question from it.byte[]toByteArray()Generate a binary paket for this dns question.java.lang.StringtoString()
-
-
-
Field Detail
-
name
private final java.lang.String name
The question string (e.g. "measite.de").
-
type
private final Record.TYPE type
The question type (e.g. A).
-
clazz
private final Record.CLASS clazz
The question class (usually IN / internet).
-
unicastQuery
private final boolean unicastQuery
UnicastQueries have the highest bit of the CLASS field set to 1.
-
byteArray
private byte[] byteArray
Cache for the serialized object.
-
-
Constructor Detail
-
Question
public Question(java.lang.String name, Record.TYPE type, Record.CLASS clazz, boolean unicastQuery)Create a dns question for the given name/type/class.- Parameters:
name- The name e.g. "measite.de".type- The type, e.g. A.clazz- The class, usually IN (internet).
-
Question
public Question(java.lang.String name, Record.TYPE type, Record.CLASS clazz)Create a dns question for the given name/type/class.- Parameters:
name- The name e.g. "measite.de".type- The type, e.g. A.clazz- The class, usually IN (internet).
-
Question
public Question(java.lang.String name, Record.TYPE type)Create a dns question for the given name/type/IN (internet class).- Parameters:
name- The name e.g. "measite.de".type- The type, e.g. A.
-
-
Method Detail
-
getType
public Record.TYPE getType()
Retrieve the type of this question.- Returns:
- The type.
-
getClazz
public Record.CLASS getClazz()
Retrieve the class of this dns question (usually internet).- Returns:
- The class of this dns question.
-
getName
public java.lang.String getName()
Retrieve the name of this dns question (e.g. "measite.de").- Returns:
- The name of this dns question.
-
parse
public static Question parse(java.io.DataInputStream dis, byte[] data) throws java.io.IOException
Parse a byte array and rebuild the dns question from it.- Parameters:
dis- The input stream.data- The plain data (for dns name references).- Returns:
- The parsed dns question.
- Throws:
java.io.IOException- On errors (read outside of packet).
-
toByteArray
public byte[] toByteArray()
Generate a binary paket for this dns question.- Returns:
- The dns question.
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object other)
- Overrides:
equalsin classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-