v5.4.4
Gitea Actions Build / Build (push) Canceled after 0s

This commit is contained in:
2026-11-17 10:16:43 +08:00
parent 510ff69e2c
commit aa83f575b1
19 changed files with 437 additions and 257 deletions
@@ -0,0 +1,60 @@
/*
* 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* ProjectName mingli-utils
* ModuleName mingli-utils.main
* CurrentFile Base64NoPaddingCodec.kt
* LastUpdate 2026-11-16 14:24:59
* UpdateUser MingLiPro
*/
package com.mingliqiye.utils.base
import java.util.*
internal class Base64NoPaddingCodec : BaseCodec {
/*
* Base64编码器实例
* 用于执行字节数组到Base64字符串的编码操作
*/
val encoder: Base64.Encoder = Base64.getUrlEncoder().withoutPadding()
/*
* Base64解码器实例
* 用于执行Base64字符串到字节数组的解码操作
*/
val decoder: Base64.Decoder = Base64.getUrlDecoder()
/*
* 将字节数组编码为Base64字符串
*
* @param bytes 待编码的字节数组
* @return 编码后的Base64字符串
*/
override fun encode(bytes: ByteArray): String {
return encoder.encodeToString(bytes)
}
/*
* 将Base64字符串解码为字节数组
*
* @param string 待解码的Base64字符串
* @return 解码后的字节数组
*/
override fun decode(string: String): ByteArray {
return decoder.decode(string)
}
}
@@ -16,7 +16,7 @@
* ProjectName mingli-utils
* ModuleName mingli-utils.main
* CurrentFile Base64UrlCodec.kt
* LastUpdate 2026-03-12 10:34:36
* LastUpdate 2026-11-16 14:24:59
* UpdateUser MingLiPro
*/
@@ -16,23 +16,36 @@
* ProjectName mingli-utils
* ModuleName mingli-utils.main
* CurrentFile BaseType.kt
* LastUpdate 2026-03-12 10:08:42
* LastUpdate 2026-11-16 14:21:51
* UpdateUser MingLiPro
*/
package com.mingliqiye.utils.base
enum class BaseType(val baseCodec: BaseCodec) : BaseCodec {
import com.mingliqiye.utils.base.code.BASE10 as CODE_BASE10
import com.mingliqiye.utils.base.code.BASE16 as CODE_BASE16
import com.mingliqiye.utils.base.code.BASE2 as CODE_BASE2
import com.mingliqiye.utils.base.code.BASE256 as CODE_BASE256
import com.mingliqiye.utils.base.code.BASE64 as CODE_BASE64
import com.mingliqiye.utils.base.code.BASE64_NO_PADDING as CODE_BASE64_NO_PADDING
import com.mingliqiye.utils.base.code.BASE64_URL as CODE_BASE64_URL
import com.mingliqiye.utils.base.code.BASE91 as CODE_BASE91
BASE2(com.mingliqiye.utils.base.code.BASE2),
BASE10(com.mingliqiye.utils.base.code.BASE10),
BASE16(com.mingliqiye.utils.base.code.BASE16),
BASE64(com.mingliqiye.utils.base.code.BASE64),
BASE64URL(com.mingliqiye.utils.base.code.BASE64URL),
BASE91(com.mingliqiye.utils.base.code.BASE91),
BASE256(com.mingliqiye.utils.base.code.BASE256);
enum class BaseType(private val baseCodec: () -> BaseCodec) : BaseCodec {
override fun encode(bytes: ByteArray) = baseCodec.encode(bytes)
override fun decode(string: String) = baseCodec.decode(string)
BASE2(::CODE_BASE2),
BASE10(::CODE_BASE10),
BASE16(::CODE_BASE16),
BASE64(::CODE_BASE64),
BASE64_URL(::CODE_BASE64_URL),
BASE64_NO_PADDING(::CODE_BASE64_NO_PADDING),
BASE91(::CODE_BASE91),
BASE256(::CODE_BASE256);
val codec
get() = baseCodec()
override fun encode(bytes: ByteArray) = codec.encode(bytes)
override fun decode(string: String) = codec.decode(string)
}
@@ -16,7 +16,7 @@
* ProjectName mingli-utils
* ModuleName mingli-utils.main
* CurrentFile BaseCodes.kt
* LastUpdate 2026-03-12 10:03:32
* LastUpdate 2026-11-16 14:10:57
* UpdateUser MingLiPro
*/
@@ -63,10 +63,16 @@ val BASE64: BaseCodec by lazy {
}
@get:JvmName("base64Url")
val BASE64URL: BaseCodec by lazy {
val BASE64_URL: BaseCodec by lazy {
Base64UrlCodec()
}
@get:JvmName("base64NoPadding")
val BASE64_NO_PADDING: BaseCodec by lazy {
Base64NoPaddingCodec()
}
/**
* 提供Base91编码器的懒加载实例。
* 该编码器用于将数据编码为Base91格式,具有较高的压缩效率。