@PublicEvolving public class AbstractID extends Object implements IOReadableWritable, Comparable<AbstractID>, Serializable
Modifier and Type | Field and Description |
---|---|
protected long |
lowerPart
The lower part of the actual ID
|
static int |
SIZE
The size of the ID in byte
|
protected long |
upperPart
The upper part of the actual ID
|
Constructor and Description |
---|
AbstractID()
Constructs a new random ID from a uniform distribution.
|
AbstractID(AbstractID id)
Creates a new abstract ID from the given one.
|
AbstractID(byte[] bytes)
Constructs a new ID with a specific bytes value.
|
AbstractID(long lowerPart,
long upperPart)
Constructs a new abstract ID.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(AbstractID o) |
boolean |
equals(Object obj) |
byte[] |
getBytes()
Gets the bytes underlying this ID.
|
long |
getLowerPart()
Gets the lower 64 bits of the ID.
|
long |
getUpperPart()
Gets the upper 64 bits of the ID.
|
int |
hashCode() |
void |
read(DataInputView in)
Reads the object's internal data from the given data input view.
|
String |
toString() |
void |
write(DataOutputView out)
Writes the object's internal data to the given data output view.
|
public static final int SIZE
protected long upperPart
protected long lowerPart
public AbstractID(byte[] bytes)
public AbstractID(long lowerPart, long upperPart)
lowerPart
- the lower bytes of the IDupperPart
- the higher bytes of the IDpublic AbstractID(AbstractID id)
The given and the newly created abstract ID will be identical, i.e. a comparison by equals
will
return true
and both objects will have the same hash code.
id
- the abstract ID to copypublic AbstractID()
public long getLowerPart()
public long getUpperPart()
public byte[] getBytes()
public void read(DataInputView in) throws IOException
IOReadableWritable
read
in interface IOReadableWritable
in
- the input view to read the data fromIOException
- thrown if any error occurs while reading from the input streampublic void write(DataOutputView out) throws IOException
IOReadableWritable
write
in interface IOReadableWritable
out
- the output view to receive the data.IOException
- thrown if any error occurs while writing to the output streampublic int compareTo(AbstractID o)
compareTo
in interface Comparable<AbstractID>
Copyright © 2014–2017 The Apache Software Foundation. All rights reserved.