public class ClassID extends java.lang.Object implements Duplicatable, GenericRecord
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.
The ClassID (or CLSID) is a UUID - see RFC 4122
(表示一个类 ID(16 个字节)。与其他 little-endian 类型不同,ClassID 不仅仅是以错误顺序存储的 16 个字节。相反,它是一个双字(4 个字节),后跟两个字(每个 2 个字节),后跟 8 个字节。 ClassID(或 CLSID)是一个 UUID - 请参阅 RFC 4122)Modifier and Type | Field and Description |
---|---|
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.
|
ClassID(ClassID other)
Clones the given ClassID
|
ClassID(LittleEndianInput lei)
Reads the ClassID from the input
|
ClassID(java.lang.String externalForm)
Creates a
ClassID from a human-readable representation of the Class ID in standard format
"{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}" .
|
Modifier and Type | Method and Description |
---|---|
ClassID |
copy() |
boolean |
equals(java.lang.Object o)
Checks whether this
ClassID is equal to another object.
(检查此 ClassID 是否等于另一个对象。)
|
boolean |
equalsInverted(ClassID o)
Checks whether this
ClassID is equal to another ClassID with inverted endianess, because there are apparently not only version 1 GUIDs (aka "network" with big-endian encoding), but also version 2 GUIDs (aka "native" with little-endian encoding) out there.
(检查此 ClassID 是否等于另一个具有反转字节序的 ClassID,因为显然不仅有版本 1 GUID(又名具有大端编码的“网络”),还有版本 2 GUID(又名具有小端编码的“本机”)在那里。)
|
byte[] |
getBytes()
Gets the bytes making out the class ID.
(获取构成类 ID 的字节。)
|
java.util.Map<java.lang.String,java.util.function.Supplier<?>> |
getGenericProperties() |
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.
(通过将 little-endian 转换为 big-endian 从字节数组中读取类 ID 的值。)
|
void |
setBytes(byte[] bytes)
Sets the bytes making out the class ID.
(设置生成类 ID 的字节。)
|
java.lang.String |
toString()
Returns a human-readable representation of the Class ID in standard format
"{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}" .
(以标准格式“{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}”返回类 ID 的人类可读表示。)
|
java.util.UUID |
toUUID()
Converts the ClassID to an UUID
(将 ClassID 转换为 UUID)
|
java.lang.String |
toUUIDString()
Returns a human-readable representation of the Class ID in UUID format
"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" .
(以 UUID 格式“xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx”返回类 ID 的人类可读表示。)
|
void |
write(byte[] dst, int offset)
Writes the class ID to a byte array in the little-endian format.
(将类 ID 写入 little-endian 格式的字节数组。)
|
void |
write(LittleEndianOutput leo)
Write the class ID to a LittleEndianOutput (stream)
(将类 ID 写入 LittleEndianOutput(流))
|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getGenericChildren, getGenericRecordType
public static final int LENGTH
public ClassID(byte[] src, int offset)
ClassID
and reads its value from a byte array.
(创建一个 ClassID 并从字节数组中读取其值。)
src
- The byte array to read from.
(src - 要读取的字节数组。)
offset
- The offset of the first byte to read.
(offset - 要读取的第一个字节的偏移量。)
public ClassID()
ClassID
and initializes its value with 0x00 bytes.
(创建一个 ClassID 并使用 0x00 字节初始化其值。)
public ClassID(ClassID other)
public ClassID(java.lang.String externalForm)
ClassID
from a human-readable representation of the Class ID in standard format
"{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}"
.
(从标准格式“{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}”的类 ID 的人类可读表示中创建一个 ClassID。)
externalForm
- representation of the Class ID represented by this object.
(externalForm - 此对象表示的类 ID 的表示形式。)
public ClassID(LittleEndianInput lei)
lei
- the input (stream)
(lei - 输入(流))
public int length()
public byte[] getBytes()
public void setBytes(byte[] bytes)
bytes
- The bytes making out the class ID in big-endian format. They are copied without their order being changed.
(bytes - 以大端格式生成类 ID 的字节。它们被复制而不改变它们的顺序。)
public byte[] read(byte[] src, int offset)
src
- The byte array to read from
(src - 要读取的字节数组)
offset
- The offset within the
src
byte array
(offset - src 字节数组中的偏移量)
public void write(byte[] dst, int offset) throws java.lang.ArrayStoreException
dst
- The byte array to write to.
(dst - 要写入的字节数组。)
offset
- The offset within the
dst
byte array.
(offset - dst 字节数组中的偏移量。)
java.lang.ArrayStoreException
- if there is not enough room for the class ID 16 bytes in the byte array after the
offset
position.
(java.lang.ArrayStoreException - 如果在偏移位置之后的字节数组中没有足够的空间容纳类 ID 16 字节。)
public void write(LittleEndianOutput leo)
leo
- the output
(狮子座 - 输出)
public boolean equals(java.lang.Object o)
ClassID
is equal to another object.
(检查此 ClassID 是否等于另一个对象。)
equals
in class
java.lang.Object
o
- the object to compare this
ClassID
with
(o - 将此 ClassID 与之比较的对象)
true
if the objects are equal, else
false
.
(如果对象相等,则为 true,否则为 false。)
public boolean equalsInverted(ClassID o)
ClassID
is equal to another ClassID with inverted endianess, because there are apparently not only version 1 GUIDs (aka "network" with big-endian encoding), but also version 2 GUIDs (aka "native" with little-endian encoding) out there.
(检查此 ClassID 是否等于另一个具有反转字节序的 ClassID,因为显然不仅有版本 1 GUID(又名具有大端编码的“网络”),还有版本 2 GUID(又名具有小端编码的“本机”)在那里。)
o
- the object to compare this
ClassID
with
(o - 将此 ClassID 与之比较的对象)
true
if the objects are equal, else
false
.
(如果对象相等,则为 true,否则为 false。)
public int hashCode()
hashCode
in class
java.lang.Object
Object.hashCode()
public java.lang.String toString()
"{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}"
.
(以标准格式“{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}”返回类 ID 的人类可读表示。)
toString
in class
java.lang.Object
public java.lang.String toUUIDString()
"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
.
(以 UUID 格式“xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx”返回类 ID 的人类可读表示。)
public java.util.UUID toUUID()
public ClassID copy()
copy
in interface
Duplicatable
(复制到界面 Duplicatable)
public java.util.Map<java.lang.String,java.util.function.Supplier<?>> getGenericProperties()
getGenericProperties
in interface
GenericRecord
(接口 GenericRecord 中的 getGenericProperties)
Copyright 2021 The Apache Software Foundation or its licensors, as applicable.