net.sf.ivmaidns.dns
Class DNSMsgHeader

java.lang.Object
  extended by net.sf.ivmaidns.dns.DNSMsgHeader
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, Immutable, Indexable, ReallyCloneable

public final class DNSMsgHeader
extends java.lang.Object
implements Immutable, ReallyCloneable, java.io.Serializable, Indexable

Class for representing DNS msg header (as defined in RFC1035).

Version:
3.0
Author:
Ivan Maidanski
See Also:
Serialized Form

Field Summary
static int AA
          NOTE: This is a bit mask for 'AA' DNS message flag (defined in RFC1035).
static int AD
          NOTE: This is a bit mask for 'AD' DNS message flag (defined in RFC2535).
protected  short anCount
          NOTE: An unsigned short integer specifying the number of entries in the answer section.
protected  short arCount
          NOTE: An unsigned short integer specifying the number of entries in the additional section.
static int BADALG
          NOTE: This extended rCode value (defined in RFC2930) indicates that the key exhange algorithm referenced in the TKEY resource record is invalid ('BADALG').
static int BADKEY
          NOTE: This extended rCode value (defined in RFC2845) indicates that the key referenced in the TSIG resource record is invalid ('BADKEY').
static int BADMODE
          NOTE: This extended rCode value (defined in RFC2930) indicates that the key exhange mode referenced in the TKEY resource record is invalid ('BADMODE').
static int BADNAME
          NOTE: This extended rCode value (defined in RFC2930) indicates that the key name referenced in the TKEY resource record is invalid ('BADNAME').
static int BADSIG
          NOTE: This extended rCode value (defined in RFC2845) indicates that the digital signature referenced in the TSIG resource record is invalid ('BADSIG'); this value also indicates an invalid OPT record version error (as defined in RFC2671).
static int BADTIME
          NOTE: This extended rCode value (defined in RFC2845) indicates that the time stamp referenced in the TSIG or TKEY resource record is invalid ('BADTIME').
static int CD
          NOTE: This is a bit mask for 'CD' DNS message flag (defined in RFC2535).
static int COUNT_LENGTH
           
protected  short flags
          NOTE: flags field consists of QR, opCode, AA, TC, RD, RA, a reserved flag (should be zero), AD, CD and rCode. opCode field (which is set by the originator of a query and copied into the response) specifies the kind of query. rCode field (response code) is set as part of responses.
static int FLAGS_LENGTH
           
static int FORMERR
          NOTE: This rCode value (defined in RFC1035) indicates that the name server was unable to interpret the request due to a format error ('FORMERR').
static int HEADER_LEN
          NOTE: This is total length (in bytes) of header.
protected  short id
          NOTE: An unsigned identifier assigned by the client that generates a query message.
static int ID_LENGTH
          NOTE: These are fields lengthes (in bytes).
static int IQUERY
          NOTE: This opCode value (defined in RFC1035) indicates an inverse query ('IQUERY').
static int MAX_COUNT
           
static int MAX_FLAGS
           
static int MAX_ID
          NOTE: These are fields bit masks.
static int MAX_OPCODE
           
static int MAX_RCODE
           
static int NOERROR
          NOTE: This rCode value (defined in RFC1035) indicates no error condition ('NOERROR').
static int NOTAUTH
          NOTE: This rCode value (defined in RFC2136) indicates that the name server is not authoritative for the requested zone ('NOTAUTH').
static int NOTIFY
          NOTE: This opCode value (defined in RFC1996) indicates a slave server notification on zone changings ('NOTIFY').
static int NOTIMP
          NOTE: This rCode value (defined in RFC1035) indicates that the name server does not support the requested kind of query ('NOTIMP').
static int NOTZONE
          NOTE: This rCode value (defined in RFC2136) indicates that the specified name is not within the denoted zone ('NOTZONE').
protected  short nsCount
          NOTE: An unsigned short integer specifying the number of entries in the authority section.
static int NXDOMAIN
          NOTE: This rCode value (defined in RFC1035) indicates that the name referenced in the query ought to exist but does not exist ('NXDOMAIN').
static int NXRRSET
          NOTE: This rCode value (defined in RFC2136) indicates that the referenced resource records set ought to exist but does not exist ('NXRRSET').
static java.lang.String OPCODE_ABBREVS
          NOTE: This is the opCode abbreviations list string.
static int OPCODE_SHIFT
           
protected  short qdCount
          NOTE: An unsigned short integer specifying the number of entries in the question section.
static int QR
          NOTE: This is a bit mask for 'QR' DNS message flag (defined in RFC1035).
static int QUERY
          NOTE: This opCode value (defined in RFC1035) indicates a standard/normal query ('QUERY').
static int RA
          NOTE: This is a bit mask for 'RA' DNS message flag (defined in RFC1035).
static java.lang.String RCODE_ABBREVS
          NOTE: This is the rCode abbreviations list string.
static int RD
          NOTE: This is a bit mask for 'RD' DNS message flag (defined in RFC1035).
static int REFUSED
          NOTE: This rCode value (defined in RFC1035) indicates that the name server refuses to perform the specified operation for policy or security reasons ('REFUSED').
static int SERVFAIL
          NOTE: This rCode value (defined in RFC1035) indicates that the name server encountered an internal failure while processing this request ('SERVFAIL').
static int STATUS
          NOTE: This opCode value (defined in RFC1035) indicates a server status request ('STATUS').
static int TC
          NOTE: This is a bit mask for 'TC' DNS message flag (defined in RFC1035).
static int UDP_PACKET_LEN
          NOTE: This is the default/maximum DNS UDP packet length (PACKET_LEN > HEADER_LEN).
static int UPDATE
          NOTE: This opCode value (defined in RFC2136) indicates an 'UPDATE' DNS message.
static int YXDOMAIN
          NOTE: This rCode value (defined in RFC2136) indicates that the referenced name ought not to exist but does exist ('YXDOMAIN').
static int YXRRSET
          NOTE: This rCode value (defined in RFC2136) indicates that the referenced resource records set ought not to exist but does exist ('YXRRSET').
 
Constructor Summary
DNSMsgHeader()
          NOTE: DNS status query header constructor.
DNSMsgHeader(byte[] msgBytes)
          NOTE: msgBytes must be !
DNSMsgHeader(int id, int flags, int qdCount, int anCount, int nsCount, int arCount)
          NOTE: Primary DNS message header constructor. id, flags, qdCount, anCount, nsCount and arCount are unsigned (must be valid).
 
Method Summary
 java.lang.Object clone()
          Creates and returns a copy of this object.
static DNSMsgHeader construct(int opCode, boolean isRecursionDesired, int qdCount, int anCount, int nsCount, int arCount, boolean isCheckingDisabled)
          NOTE: Any query message header constructor. opCode must be valid.
 DNSMsgHeader constructResponse(int rCode, boolean isAuthoritativeAnswer, boolean isTruncated, boolean isRecursionAvailable, boolean isAuthenticData, int qdCount, int anCount, int nsCount, int arCount)
          NOTE: Server response message header constructor. rCode must be valid. qdCount, anCount, nsCount and arCount are unsigned (must be valid).
 boolean equals(java.lang.Object obj)
           
static java.lang.String flagBitsAbbreviation(int flags)
          NOTE: flags value is unsigned.
 int getAnCount()
          NOTE: Result is unsigned.
 int getArCount()
          NOTE: Result is unsigned.
 java.lang.Object getAt(int index)
          NOTE: Result is new UnsignedInt((new int[] { getId(), getFlags(), getQdCount(), getAnCount(), getNsCount(), getArCount() })[index]).
 int getFlags()
          NOTE: Result is unsigned.
 int getId()
          NOTE: May be 0 in AXFR response messages (starting from the second message).
 int getNsCount()
          NOTE: Result is unsigned.
 int getOpCode()
          NOTE: Result >= 0.
 int getQdCount()
          NOTE: Result is unsigned.
static int getQdCount(byte[] msgBytes)
          NOTE: msgBytes must be !
 int getRCode()
          NOTE: Result >= 0.
static int getTotalCount(byte[] msgBytes)
          NOTE: msgBytes must be !
 int hashCode()
           
 boolean isAuthenticData()
          NOTE: Result is the same as of ((getFlags() & AD) !
 boolean isAuthoritativeAnswer()
           
 boolean isCheckingDisabled()
          NOTE: Result is the same as of ((getFlags() & CD) !
 boolean isRecursionAvailable()
           
 boolean isRecursionDesired()
           
 boolean isResponse()
           
 boolean isTruncated()
           
static boolean isTruncated(byte[] msgBytes)
          NOTE: msgBytes must be !
 int length()
          NOTE: Result is the number of elements accessible through getAt(int).
 void putTo(byte[] msgBytes)
          NOTE: msgBytes must be !
static void setTruncated(byte[] msgBytes)
          NOTE: msgBytes must be !
 java.lang.String toString()
          NOTE: Result !
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

QUERY

public static final int QUERY
NOTE: This opCode value (defined in RFC1035) indicates a standard/normal query ('QUERY').

See Also:
Constant Field Values

IQUERY

public static final int IQUERY
NOTE: This opCode value (defined in RFC1035) indicates an inverse query ('IQUERY'). It is used mainly during a DNS server debugging process.

See Also:
Constant Field Values

STATUS

public static final int STATUS
NOTE: This opCode value (defined in RFC1035) indicates a server status request ('STATUS').

See Also:
Constant Field Values

NOTIFY

public static final int NOTIFY
NOTE: This opCode value (defined in RFC1996) indicates a slave server notification on zone changings ('NOTIFY').

See Also:
Constant Field Values

UPDATE

public static final int UPDATE
NOTE: This opCode value (defined in RFC2136) indicates an 'UPDATE' DNS message.

See Also:
Constant Field Values

NOERROR

public static final int NOERROR
NOTE: This rCode value (defined in RFC1035) indicates no error condition ('NOERROR').

See Also:
Constant Field Values

FORMERR

public static final int FORMERR
NOTE: This rCode value (defined in RFC1035) indicates that the name server was unable to interpret the request due to a format error ('FORMERR').

See Also:
Constant Field Values

SERVFAIL

public static final int SERVFAIL
NOTE: This rCode value (defined in RFC1035) indicates that the name server encountered an internal failure while processing this request ('SERVFAIL'). This means an operating system error or forwarding timeout.

See Also:
Constant Field Values

NXDOMAIN

public static final int NXDOMAIN
NOTE: This rCode value (defined in RFC1035) indicates that the name referenced in the query ought to exist but does not exist ('NXDOMAIN'). This is meaningful only for responses from an authoritative name server.

See Also:
Constant Field Values

NOTIMP

public static final int NOTIMP
NOTE: This rCode value (defined in RFC1035) indicates that the name server does not support the requested kind of query ('NOTIMP').

See Also:
Constant Field Values

REFUSED

public static final int REFUSED
NOTE: This rCode value (defined in RFC1035) indicates that the name server refuses to perform the specified operation for policy or security reasons ('REFUSED').

See Also:
Constant Field Values

YXDOMAIN

public static final int YXDOMAIN
NOTE: This rCode value (defined in RFC2136) indicates that the referenced name ought not to exist but does exist ('YXDOMAIN').

See Also:
Constant Field Values

YXRRSET

public static final int YXRRSET
NOTE: This rCode value (defined in RFC2136) indicates that the referenced resource records set ought not to exist but does exist ('YXRRSET').

See Also:
Constant Field Values

NXRRSET

public static final int NXRRSET
NOTE: This rCode value (defined in RFC2136) indicates that the referenced resource records set ought to exist but does not exist ('NXRRSET').

See Also:
Constant Field Values

NOTAUTH

public static final int NOTAUTH
NOTE: This rCode value (defined in RFC2136) indicates that the name server is not authoritative for the requested zone ('NOTAUTH').

See Also:
Constant Field Values

NOTZONE

public static final int NOTZONE
NOTE: This rCode value (defined in RFC2136) indicates that the specified name is not within the denoted zone ('NOTZONE').

See Also:
Constant Field Values

BADSIG

public static final int BADSIG
NOTE: This extended rCode value (defined in RFC2845) indicates that the digital signature referenced in the TSIG resource record is invalid ('BADSIG'); this value also indicates an invalid OPT record version error (as defined in RFC2671). Extended rCode values are used in resource records (such as OPT, TSIG, TKEY) only, not in a message header.

Since:
2.2
See Also:
Constant Field Values

BADKEY

public static final int BADKEY
NOTE: This extended rCode value (defined in RFC2845) indicates that the key referenced in the TSIG resource record is invalid ('BADKEY'). Extended rCode values are used in resource records (such as OPT, TSIG, TKEY) only, not in a message header.

Since:
2.2
See Also:
Constant Field Values

BADTIME

public static final int BADTIME
NOTE: This extended rCode value (defined in RFC2845) indicates that the time stamp referenced in the TSIG or TKEY resource record is invalid ('BADTIME'). Extended rCode values are used in resource records (such as OPT, TSIG, TKEY) only, not in a message header.

Since:
2.2
See Also:
Constant Field Values

BADMODE

public static final int BADMODE
NOTE: This extended rCode value (defined in RFC2930) indicates that the key exhange mode referenced in the TKEY resource record is invalid ('BADMODE'). Extended rCode values are used in resource records (such as OPT, TSIG, TKEY) only, not in a message header.

Since:
2.2
See Also:
Constant Field Values

BADNAME

public static final int BADNAME
NOTE: This extended rCode value (defined in RFC2930) indicates that the key name referenced in the TKEY resource record is invalid ('BADNAME'). Extended rCode values are used in resource records (such as OPT, TSIG, TKEY) only, not in a message header.

Since:
2.2
See Also:
Constant Field Values

BADALG

public static final int BADALG
NOTE: This extended rCode value (defined in RFC2930) indicates that the key exhange algorithm referenced in the TKEY resource record is invalid ('BADALG'). Extended rCode values are used in resource records (such as OPT, TSIG, TKEY) only, not in a message header.

Since:
2.2
See Also:
Constant Field Values

QR

public static final int QR
NOTE: This is a bit mask for 'QR' DNS message flag (defined in RFC1035). If this flag (query response) is set then the message is a response, else it is a query.

See Also:
Constant Field Values

AA

public static final int AA
NOTE: This is a bit mask for 'AA' DNS message flag (defined in RFC1035). This flag (authoritative answer) is valid in responses and specifies that the responding name server is an authority for the domain name in question section (the flag corresponds only to the name which matches the query name, or the first owner name in the answer section).

See Also:
Constant Field Values

TC

public static final int TC
NOTE: This is a bit mask for 'TC' DNS message flag (defined in RFC1035). This set flag (truncation) specifies that the message was truncated due to length greater than that permitted on the transmission channel.

See Also:
Constant Field Values

RD

public static final int RD
NOTE: This is a bit mask for 'RD' DNS message flag (defined in RFC1035). This flag (recursion desired) may be set in a query and is copied into the response, if it is set then it directs the name server (if available) to pursue the query recursively.

See Also:
Constant Field Values

RA

public static final int RA
NOTE: This is a bit mask for 'RA' DNS message flag (defined in RFC1035). This flag (recursion available) is set or cleared in a response, and denotes whether recursive query support is available in the name server.

See Also:
Constant Field Values

AD

public static final int AD
NOTE: This is a bit mask for 'AD' DNS message flag (defined in RFC2535). This flag (authentic data) indicates in a response that all the data included in the answer and authority portion of the response has been authenticated by the server according to the policies of that server.

Since:
2.2
See Also:
Constant Field Values

CD

public static final int CD
NOTE: This is a bit mask for 'CD' DNS message flag (defined in RFC2535). This flag (checking disabled) may be set in a query and is copied into the response, if it is set then it indicates that pending (non-authenticated) data is acceptable to the resolver sending the query.

Since:
2.2
See Also:
Constant Field Values

ID_LENGTH

public static final int ID_LENGTH
NOTE: These are fields lengthes (in bytes).

Since:
2.2
See Also:
Constant Field Values

FLAGS_LENGTH

public static final int FLAGS_LENGTH
See Also:
Constant Field Values

COUNT_LENGTH

public static final int COUNT_LENGTH
See Also:
Constant Field Values

HEADER_LEN

public static final int HEADER_LEN
NOTE: This is total length (in bytes) of header.

Since:
2.2
See Also:
Constant Field Values

UDP_PACKET_LEN

public static final int UDP_PACKET_LEN
NOTE: This is the default/maximum DNS UDP packet length (PACKET_LEN > HEADER_LEN).

Since:
2.2
See Also:
Constant Field Values

MAX_ID

public static final int MAX_ID
NOTE: These are fields bit masks.

See Also:
Constant Field Values

MAX_FLAGS

public static final int MAX_FLAGS
See Also:
Constant Field Values

MAX_COUNT

public static final int MAX_COUNT
See Also:
Constant Field Values

MAX_OPCODE

public static final int MAX_OPCODE
See Also:
Constant Field Values

MAX_RCODE

public static final int MAX_RCODE
See Also:
Constant Field Values

OPCODE_SHIFT

public static final int OPCODE_SHIFT
See Also:
Constant Field Values

OPCODE_ABBREVS

public static final java.lang.String OPCODE_ABBREVS
NOTE: This is the opCode abbreviations list string.

Since:
3.0
See Also:
Constant Field Values

RCODE_ABBREVS

public static final java.lang.String RCODE_ABBREVS
NOTE: This is the rCode abbreviations list string.

Since:
3.0
See Also:
Constant Field Values

id

protected final short id
NOTE: An unsigned identifier assigned by the client that generates a query message. This identifier is copied into the corresponding reply and can be used by the requester to match up replies to outstanding queries.


flags

protected final short flags
NOTE: flags field consists of QR, opCode, AA, TC, RD, RA, a reserved flag (should be zero), AD, CD and rCode. opCode field (which is set by the originator of a query and copied into the response) specifies the kind of query. rCode field (response code) is set as part of responses.


qdCount

protected final short qdCount
NOTE: An unsigned short integer specifying the number of entries in the question section.


anCount

protected final short anCount
NOTE: An unsigned short integer specifying the number of entries in the answer section.


nsCount

protected final short nsCount
NOTE: An unsigned short integer specifying the number of entries in the authority section.


arCount

protected final short arCount
NOTE: An unsigned short integer specifying the number of entries in the additional section.

Constructor Detail

DNSMsgHeader

public DNSMsgHeader()
NOTE: DNS status query header constructor.


DNSMsgHeader

public DNSMsgHeader(int id,
                    int flags,
                    int qdCount,
                    int anCount,
                    int nsCount,
                    int arCount)
             throws java.lang.IllegalArgumentException
NOTE: Primary DNS message header constructor. id, flags, qdCount, anCount, nsCount and arCount are unsigned (must be valid).

Throws:
java.lang.IllegalArgumentException

DNSMsgHeader

public DNSMsgHeader(byte[] msgBytes)
             throws java.lang.NullPointerException,
                    java.lang.ArrayIndexOutOfBoundsException
NOTE: msgBytes must be != null and msgBytes length >= HEADER_LEN. Constructor for creating header from message bytes. msgBytes array is not changed anyway.

Throws:
java.lang.NullPointerException
java.lang.ArrayIndexOutOfBoundsException
Since:
2.2
Method Detail

putTo

public void putTo(byte[] msgBytes)
           throws java.lang.NullPointerException,
                  java.lang.ArrayIndexOutOfBoundsException
NOTE: msgBytes must be != null and msgBytes length >= HEADER_LEN. Method for putting header to message bytes. msgBytes array is altered (unless an exception is thrown).

Throws:
java.lang.NullPointerException
java.lang.ArrayIndexOutOfBoundsException
Since:
2.2

setTruncated

public static final void setTruncated(byte[] msgBytes)
                               throws java.lang.NullPointerException,
                                      java.lang.ArrayIndexOutOfBoundsException
NOTE: msgBytes must be != null and msgBytes length >= HEADER_LEN. msgBytes array is altered (unless an exception is thrown).

Throws:
java.lang.NullPointerException
java.lang.ArrayIndexOutOfBoundsException
Since:
3.0

isTruncated

public static final boolean isTruncated(byte[] msgBytes)
                                 throws java.lang.NullPointerException,
                                        java.lang.ArrayIndexOutOfBoundsException
NOTE: msgBytes must be != null and msgBytes length >= HEADER_LEN. msgBytes array is not changed anyway. The result is the same as of (new DNSMsgHeader(msgBytes)) isTruncated().

Throws:
java.lang.NullPointerException
java.lang.ArrayIndexOutOfBoundsException
Since:
3.0

getQdCount

public static final int getQdCount(byte[] msgBytes)
                            throws java.lang.NullPointerException,
                                   java.lang.ArrayIndexOutOfBoundsException
NOTE: msgBytes must be != null and msgBytes length >= HEADER_LEN. msgBytes array is not changed anyway. The result is the same as of (new DNSMsgHeader(msgBytes)) getQdCount(). Result is unsigned.

Throws:
java.lang.NullPointerException
java.lang.ArrayIndexOutOfBoundsException
Since:
3.0

getTotalCount

public static final int getTotalCount(byte[] msgBytes)
                               throws java.lang.NullPointerException,
                                      java.lang.ArrayIndexOutOfBoundsException
NOTE: msgBytes must be != null and msgBytes length >= HEADER_LEN. msgBytes array is not changed anyway. The result is the sum of qdCount, anCount, nsCount and arCount of (new DNSMsgHeader(msgBytes)). Result >= 0.

Throws:
java.lang.NullPointerException
java.lang.ArrayIndexOutOfBoundsException
Since:
3.0

construct

public static DNSMsgHeader construct(int opCode,
                                     boolean isRecursionDesired,
                                     int qdCount,
                                     int anCount,
                                     int nsCount,
                                     int arCount,
                                     boolean isCheckingDisabled)
                              throws java.lang.IllegalArgumentException
NOTE: Any query message header constructor. opCode must be valid. qdCount, anCount, nsCount and arCount are unsigned (must be valid). Message id is random. Result != null.

Throws:
java.lang.IllegalArgumentException

constructResponse

public DNSMsgHeader constructResponse(int rCode,
                                      boolean isAuthoritativeAnswer,
                                      boolean isTruncated,
                                      boolean isRecursionAvailable,
                                      boolean isAuthenticData,
                                      int qdCount,
                                      int anCount,
                                      int nsCount,
                                      int arCount)
                               throws java.lang.IllegalArgumentException
NOTE: Server response message header constructor. rCode must be valid. qdCount, anCount, nsCount and arCount are unsigned (must be valid). Result != null, result != this.

Throws:
java.lang.IllegalArgumentException
Since:
2.2

getId

public final int getId()
NOTE: May be 0 in AXFR response messages (starting from the second message). Result is unsigned.


getFlags

public final int getFlags()
NOTE: Result is unsigned.


isResponse

public final boolean isResponse()

getOpCode

public final int getOpCode()
NOTE: Result >= 0.


isAuthoritativeAnswer

public final boolean isAuthoritativeAnswer()

isTruncated

public final boolean isTruncated()

isRecursionDesired

public final boolean isRecursionDesired()

isRecursionAvailable

public final boolean isRecursionAvailable()

isAuthenticData

public final boolean isAuthenticData()
NOTE: Result is the same as of ((getFlags() & AD) != 0).

Since:
2.2

isCheckingDisabled

public final boolean isCheckingDisabled()
NOTE: Result is the same as of ((getFlags() & CD) != 0).

Since:
2.2

getRCode

public final int getRCode()
NOTE: Result >= 0.


getQdCount

public final int getQdCount()
NOTE: Result is unsigned.


getAnCount

public final int getAnCount()
NOTE: Result is unsigned.


getNsCount

public final int getNsCount()
NOTE: Result is unsigned.


getArCount

public final int getArCount()
NOTE: Result is unsigned.


length

public int length()
NOTE: Result is the number of elements accessible through getAt(int).

Specified by:
length in interface Indexable
Returns:
amount (non-negative value) of elements.
Since:
2.1
See Also:
Indexable.getAt(int)

getAt

public java.lang.Object getAt(int index)
                       throws java.lang.ArrayIndexOutOfBoundsException
NOTE: Result is new UnsignedInt((new int[] { getId(), getFlags(), getQdCount(), getAnCount(), getNsCount(), getArCount() })[index]).

Specified by:
getAt in interface Indexable
Parameters:
index - the index (must be in the range) at which to return an element.
Returns:
an element (may be null) at index.
Throws:
java.lang.ArrayIndexOutOfBoundsException - if index is negative or is not less than length().
Since:
2.1
See Also:
Indexable.length()

flagBitsAbbreviation

public static final java.lang.String flagBitsAbbreviation(int flags)
NOTE: flags value is unsigned. Only known bit flags are represented in the result. Result != null, result length() > 0, result is 'in-line'.


clone

public java.lang.Object clone()
Description copied from interface: ReallyCloneable
Creates and returns a copy of this object. By the clone() standard definition, this method creates a new instance of the class of this object and initializes all its fields with exactly the contents of the corresponding fields of this object. Typically, native clone() method of Object class is used inside this method.

Specified by:
clone in interface ReallyCloneable
Overrides:
clone in class java.lang.Object
Returns:
a copy (not null and != this) of this instance.

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

toString

public java.lang.String toString()
NOTE: Result != null, result length() > 0, result is 'in-line'.

Overrides:
toString in class java.lang.Object