public class ClassID
extends java.lang.Object
Represents a class ID (16 bytes). Unlike other little-endian
type the ClassID
is not just 16 bytes stored in the wrong
order. Instead, it is a double word (4 bytes) followed by two
words (2 bytes each) followed by 8 bytes.
Modifier and Type | Field and Description |
---|---|
protected byte[] |
bytes
The bytes making out the class ID in correct order,
i.e. big-endian.
|
static int |
LENGTH
The number of bytes occupied by this object in the byte
stream.
|
Constructor and Description |
---|
ClassID()
Creates a
ClassID and initializes its value with
0x00 bytes. |
ClassID(byte[] src,
int offset)
Creates a
ClassID and reads its value from a byte
array. |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object o)
Checks whether this
ClassID is equal to another
object. |
byte[] |
getBytes()
Gets the bytes making out the class ID.
|
int |
hashCode() |
int |
length() |
byte[] |
read(byte[] src,
int offset)
Reads the class ID's value from a byte array by turning
little-endian into big-endian.
|
void |
setBytes(byte[] bytes)
Sets the bytes making out the class ID.
|
java.lang.String |
toString()
Returns a human-readable representation of the Class ID in standard
format
"{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}" . |
void |
write(byte[] dst,
int offset)
Writes the class ID to a byte array in the
little-endian format.
|
protected byte[] bytes
The bytes making out the class ID in correct order, i.e. big-endian.
public static final int LENGTH
The number of bytes occupied by this object in the byte stream.
public ClassID(byte[] src, int offset)
Creates a ClassID
and reads its value from a byte
array.
src
- The byte array to read from.offset
- The offset of the first byte to read.public ClassID()
Creates a ClassID
and initializes its value with
0x00 bytes.
public int length()
public byte[] getBytes()
Gets the bytes making out the class ID. They are returned in correct order, i.e. big-endian.
public void setBytes(byte[] bytes)
Sets the bytes making out the class ID.
bytes
- The bytes making out the class ID in big-endian format. They
are copied without their order being changed.public byte[] read(byte[] src, int offset)
Reads the class ID's value from a byte array by turning little-endian into big-endian.
src
- The byte array to read fromoffset
- The offset within the src byte arraypublic void write(byte[] dst, int offset) throws java.lang.ArrayStoreException
Writes the class ID to a byte array in the little-endian format.
dst
- The byte array to write to.offset
- The offset within the dst byte array.java.lang.ArrayStoreException
- if there is not enough room for the class
ID 16 bytes in the byte array after the offset position.public boolean equals(java.lang.Object o)
Checks whether this ClassID
is equal to another
object.
equals
in class java.lang.Object
o
- the object to compare this PropertySet
withtrue
if the objects are equal, else
false
.public int hashCode()
hashCode
in class java.lang.Object
Object.hashCode()
public java.lang.String toString()
Returns a human-readable representation of the Class ID in standard
format "{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}"
.
toString
in class java.lang.Object
Copyright © 2005-2010 Potix Corporation. All Rights Reserved.