public class ClusterId
extends java.lang.Object
implements java.io.Externalizable, java.lang.Comparable
Constructor and Description |
---|
ClusterId()
Create a new identifier
|
ClusterId(byte[] id)
Create a new identifier from an array of byte
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(java.lang.Object o) |
boolean |
equals(java.lang.Object o)
Compare two identifier
|
byte[] |
getBytes()
get the identifier in array of bytes type
|
int |
hashCode()
get the hascode
|
static void |
main(java.lang.String[] args)
Useful for tests only.
|
boolean |
match(byte[] ar)
Compare two identifiers
|
static ClusterId |
read(java.io.DataInput in)
Read an identifier from an input stream (java.io.DataInput)
|
void |
readExternal(java.io.ObjectInput in)
Read an identifier from an input stream (java.io.ObjectInput)
|
java.lang.String |
toString()
Readable format.
|
void |
write(java.io.DataOutput out)
Write an identifier on the output stream (java.io.DataOutput)
|
void |
writeExternal(java.io.ObjectOutput out)
Write an identifier on the output stream (java.io.ObjectOutput)
|
public ClusterId()
public ClusterId(byte[] id)
id
- array of bytepublic int hashCode()
hashCode
in class java.lang.Object
public boolean match(byte[] ar)
ar
- array of bytes to compare with the identifierpublic boolean equals(java.lang.Object o)
equals
in class java.lang.Object
o
- object to comparepublic byte[] getBytes()
public int compareTo(java.lang.Object o)
compareTo
in interface java.lang.Comparable
Comparable.compareTo(java.lang.Object)
public java.lang.String toString()
toString
in class java.lang.Object
public void readExternal(java.io.ObjectInput in) throws java.io.IOException, java.lang.ClassNotFoundException
readExternal
in interface java.io.Externalizable
in
- the input streamjava.io.IOException
- if exception is encounteredjava.lang.ClassNotFoundException
- if exception is encounteredpublic void writeExternal(java.io.ObjectOutput out) throws java.io.IOException
writeExternal
in interface java.io.Externalizable
out
- the output streamjava.io.IOException
- if exception is encounteredpublic static ClusterId read(java.io.DataInput in) throws java.io.IOException
in
- the input streamjava.io.IOException
- if exception is encounteredpublic void write(java.io.DataOutput out) throws java.io.IOException
out
- the output streamjava.io.IOException
- if exception is encounteredpublic static void main(java.lang.String[] args) throws java.lang.Exception
args
- arguments listjava.lang.Exception
- if an error occurs