类 BytesBase62
- java.lang.Object
-
- net.qimooc.commons.utils.BytesBase62
-
public class BytesBase62 extends java.lang.ObjectA Base62 encoder/decoder.- 作者:
- Sebastian Ruhleder, sebastian@seruco.io https://github.com/seruco/base62
-
-
方法概要
所有方法 静态方法 实例方法 具体方法 修饰符和类型 方法 说明 static BytesBase62createInstance()Creates aBytesBase62instance.static BytesBase62createInstanceWithGmpCharacterSet()Creates aBytesBase62instance using the GMP-style character set.static BytesBase62createInstanceWithInvertedCharacterSet()Creates aBytesBase62instance using the inverted character set.byte[]decode(byte[] encoded)Decodes a sequence of Base62-encoded bytes.byte[]encode(byte[] message)Encodes a sequence of bytes in Base62 encoding.booleanisBase62Encoding(byte[] bytes)Checks whether a sequence of bytes is encoded over a Base62 alphabet.
-
-
-
方法详细资料
-
createInstance
public static BytesBase62 createInstance()
Creates aBytesBase62instance. Defaults to the GMP-style character set.- 返回:
- a
BytesBase62instance.
-
createInstanceWithGmpCharacterSet
public static BytesBase62 createInstanceWithGmpCharacterSet()
Creates aBytesBase62instance using the GMP-style character set.- 返回:
- a
BytesBase62instance.
-
createInstanceWithInvertedCharacterSet
public static BytesBase62 createInstanceWithInvertedCharacterSet()
Creates aBytesBase62instance using the inverted character set.- 返回:
- a
BytesBase62instance.
-
encode
public byte[] encode(byte[] message)
Encodes a sequence of bytes in Base62 encoding.- 参数:
message- a byte sequence.- 返回:
- a sequence of Base62-encoded bytes.
-
decode
public byte[] decode(byte[] encoded)
Decodes a sequence of Base62-encoded bytes.- 参数:
encoded- a sequence of Base62-encoded bytes.- 返回:
- a byte sequence.
- 抛出:
java.lang.IllegalArgumentException- whenencodedis not encoded over the Base62 alphabet.
-
isBase62Encoding
public boolean isBase62Encoding(byte[] bytes)
Checks whether a sequence of bytes is encoded over a Base62 alphabet.- 参数:
bytes- a sequence of bytes.- 返回:
truewhen the bytes are encoded over a Base62 alphabet,falseotherwise.
-
-