refactor(time): 重构 DateTime 类并添加新功能
- 从 Java 文件中删除了旧的 DateTime 类 - 新增 Kotlin 版本的 DateTime 类,具有以下改进: - 添加了时间格式化枚举类 Formatter - 新增时间位移类 DateTimeOffset - 重构了 parse 和 format 方法,支持新的 Formatter 枚举 - 优化了文件时间转换方法,使用纳秒精度 - 删除了旧的 DateTimeJsonConverter 类
This commit is contained in:
@@ -16,15 +16,13 @@
|
||||
* ProjectName mingli-utils
|
||||
* ModuleName mingli-utils.main
|
||||
* CurrentFile RandomBytes.kt
|
||||
* LastUpdate 2025-09-15 00:08:18
|
||||
* LastUpdate 2025-09-15 09:54:33
|
||||
* UpdateUser MingLiPro
|
||||
*/
|
||||
@file:JvmName("RandomBytes")
|
||||
|
||||
package com.mingliqiye.utils.random
|
||||
|
||||
import com.mingliqiye.utils.iterator.Range
|
||||
|
||||
/**
|
||||
* 生成指定长度的随机字节数组
|
||||
* @param length 数组长度
|
||||
@@ -32,7 +30,9 @@ import com.mingliqiye.utils.iterator.Range
|
||||
*/
|
||||
fun randomBytes(length: Int): ByteArray {
|
||||
val bytes = ByteArray(length)
|
||||
Range(0, length - 1).forEach { i: Int -> bytes[i] = randomByte(0x00.toByte(), 0xff.toByte()) }
|
||||
for (i in 0..<length) {
|
||||
bytes[i] = randomByte(0x00.toByte(), 0xff.toByte())
|
||||
}
|
||||
return bytes
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user