feat(network): 增强网络地址端口处理功能
- 添加IPv4地址与字节数组相互转换功能 - 实现ByteBuffer与网络地址端口的读写操作 - 增加网络端点字节数组序列化支持 - 添加Netty框架ByteBuf转换工具类 - 更新项目版本号至4.2.6 - 修改依赖引入方式为compileOnly - 移除未使用的SuperStream导入 - 添加UUID类ByteBuffer读写功能 - 创建新的测试主函数验证功能
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2025 mingliqiye
|
||||
* Copyright 2026 mingliqiye
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -16,7 +16,7 @@
|
||||
* ProjectName mingli-utils
|
||||
* ModuleName mingli-utils.main
|
||||
* CurrentFile UUID.kt
|
||||
* LastUpdate 2025-09-21 21:53:40
|
||||
* LastUpdate 2026-01-06 12:55:04
|
||||
* UpdateUser MingLiPro
|
||||
*/
|
||||
|
||||
@@ -234,6 +234,19 @@ class UUID : Serializable {
|
||||
return UUID(msb, lsb)
|
||||
}
|
||||
|
||||
/**
|
||||
* 从ByteBuffer创建UUID对象
|
||||
*
|
||||
* @param byteBuffer 包含UUID字节数据的ByteBuffer对象,必须包含至少16个字节的数据
|
||||
* @return 从ByteBuffer中读取的16个字节创建的UUID对象
|
||||
*/
|
||||
@JvmStatic
|
||||
fun of(byteBuffer: ByteBuffer): UUID {
|
||||
val byte = ByteArray(16)
|
||||
byteBuffer.get(byte)
|
||||
return UUID(byte)
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据 MySQL UUID 字节数组创建 UUID 实例。
|
||||
*
|
||||
@@ -296,7 +309,6 @@ class UUID : Serializable {
|
||||
return UUID(this)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 从字符串解析 UUID 字节数组。
|
||||
*
|
||||
@@ -422,6 +434,10 @@ class UUID : Serializable {
|
||||
return data
|
||||
}
|
||||
|
||||
fun writeToByteBuffer(byteBuffer: ByteBuffer): ByteBuffer {
|
||||
return byteBuffer.put(data)
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回 UUID 的高位长整型部分。
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user