Class Base62Provider
java.lang.Object
org.miaixz.bus.core.codec.binary.provider.Base62Provider
- All Implemented Interfaces:
Serializable,Decoder<byte[],,byte[]> Encoder<byte[],byte[]>
public class Base62Provider
extends Object
implements Encoder<byte[],byte[]>, Decoder<byte[],byte[]>, Serializable
Base62编码解码实现,常用于短URL From https://github.com/seruco/base62
- Since:
- Java 17+
- Author:
- Kimi Liu
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic byte[]convert(byte[] message, int sourceBase, int targetBase) 使用定义的字母表从源基准到目标基准byte[]decode(byte[] encoded) 解码Base62消息byte[]decode(byte[] encoded, boolean useInverted) 解码Base62消息byte[]encode(byte[] data) 编码指定消息bytes为Base62格式的bytesbyte[]encode(byte[] data, boolean useInverted) 编码指定消息bytes为Base62格式的bytesstatic byte[]translate(byte[] indices, byte[] dictionary) 按照字典转换bytes
-
Field Details
-
serialVersionUID
public static final long serialVersionUID- See Also:
-
INSTANCE
单例
-
-
Constructor Details
-
Base62Provider
public Base62Provider()
-
-
Method Details
-
translate
public static byte[] translate(byte[] indices, byte[] dictionary) 按照字典转换bytes- Parameters:
indices- 内容dictionary- 字典- Returns:
- 转换值
-
convert
public static byte[] convert(byte[] message, int sourceBase, int targetBase) 使用定义的字母表从源基准到目标基准- Parameters:
message- 消息bytessourceBase- 源基准长度targetBase- 目标基准长度- Returns:
- 计算结果
-
encode
public byte[] encode(byte[] data) 编码指定消息bytes为Base62格式的bytes -
encode
public byte[] encode(byte[] data, boolean useInverted) 编码指定消息bytes为Base62格式的bytes- Parameters:
data- 被编码的消息useInverted- 是否使用反转风格,即将GMP风格中的大小写做转换- Returns:
- Base62内容
-
decode
public byte[] decode(byte[] encoded) 解码Base62消息 -
decode
public byte[] decode(byte[] encoded, boolean useInverted) 解码Base62消息- Parameters:
encoded- Base62内容useInverted- 是否使用反转风格,即将GMP风格中的大小写做转换- Returns:
- 消息
-