org.xbill.DNS
Class Header

java.lang.Object
  |
  +--org.xbill.DNS.Header

public class Header
extends Object

A DNS message header

See Also:
Message

Constructor Summary
Header()
          Create a new empty header with a random message id
Header(DataByteInputStream in)
          Parses a Header from a stream containing DNS wire format.
Header(int _id)
          Create a new empty header.
 
Method Summary
 Object clone()
           
 int getCount(int field)
          Retrieves the record count for the given section
 boolean getFlag(int bit)
          Retrieves a flag
 int getID()
          Retrieves the message ID
 byte getOpcode()
          Retrieves the mesasge's opcode
 short getRcode()
          Retrieves the mesasge's rcode
 String printFlags()
          Converts the header's flags into a String
 void setFlag(int bit)
          Sets a flag to the supplied value
 void setID(int _id)
          Sets the message ID
 void setOpcode(byte value)
          Sets the message's opcode
 void setRcode(short value)
          Sets the message's rcode
 String toString()
          Converts the header into a String
 byte[] toWire()
           
 void unsetFlag(int bit)
          Sets a flag to the supplied value
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Header

public Header(int _id)
Create a new empty header.
Parameters:
id - The message id

Header

public Header()
Create a new empty header with a random message id

Header

public Header(DataByteInputStream in)
       throws IOException
Parses a Header from a stream containing DNS wire format. This normally isn't useful to clients.
Method Detail

toWire

public byte[] toWire()
              throws IOException

setFlag

public void setFlag(int bit)
Sets a flag to the supplied value
See Also:
Flags

unsetFlag

public void unsetFlag(int bit)
Sets a flag to the supplied value
See Also:
Flags

getFlag

public boolean getFlag(int bit)
Retrieves a flag
See Also:
Flags

getID

public int getID()
Retrieves the message ID

setID

public void setID(int _id)
Sets the message ID

setRcode

public void setRcode(short value)
Sets the message's rcode
See Also:
Rcode

getRcode

public short getRcode()
Retrieves the mesasge's rcode
See Also:
Rcode

setOpcode

public void setOpcode(byte value)
Sets the message's opcode
See Also:
Opcode

getOpcode

public byte getOpcode()
Retrieves the mesasge's opcode
See Also:
Opcode

getCount

public int getCount(int field)
Retrieves the record count for the given section
See Also:
Section

printFlags

public String printFlags()
Converts the header's flags into a String

toString

public String toString()
Converts the header into a String
Overrides:
toString in class Object

clone

public Object clone()
Overrides:
clone in class Object