jjzjj

nameUUIDFromBytes

全部标签

java - 将 UUID 转换回字符串输入 - nameUUIDFromBytes

我正在使用函数UUID.nameUUIDFromBytes(byte[])[1]将字符串转换为UUID。获得UUID后是否可以转换回原始字符串?[1]https://docs.oracle.com/javase/8/docs/api/java/util/UUID.html#nameUUIDFromBytes-byte:A- 最佳答案 这是UUID的类描述UUIDisanimmutablerepresentationofa128-bituniversallyuniqueidentifier(UUID).Therearemultiple

java - 将 uuid 转换为字节,这在使用 UUID.nameUUIDFromBytes(b) 时有效

我正在使用此代码将UUID转换为字节publicbyte[]getIdAsByte(UUIDuuid){ByteBufferbb=ByteBuffer.wrap(newbyte[16]);bb.putLong(uuid.getMostSignificantBits());bb.putLong(uuid.getLeastSignificantBits());returnbb.array();}但是,如果我尝试使用此函数重新创建UUID,publicUUIDfrombyte(byte[]b){returnUUID.nameUUIDFromBytes(b);}它不是同一个UUID。来回转换一

java - 将 uuid 转换为字节,这在使用 UUID.nameUUIDFromBytes(b) 时有效

我正在使用此代码将UUID转换为字节publicbyte[]getIdAsByte(UUIDuuid){ByteBufferbb=ByteBuffer.wrap(newbyte[16]);bb.putLong(uuid.getMostSignificantBits());bb.putLong(uuid.getLeastSignificantBits());returnbb.array();}但是,如果我尝试使用此函数重新创建UUID,publicUUIDfrombyte(byte[]b){returnUUID.nameUUIDFromBytes(b);}它不是同一个UUID。来回转换一