类 BytesBase62


  • public class BytesBase62
    extends java.lang.Object
    A Base62 encoder/decoder.
    作者:
    Sebastian Ruhleder, sebastian@seruco.io https://github.com/seruco/base62
    • 方法详细资料

      • createInstance

        public static BytesBase62 createInstance()
        Creates a BytesBase62 instance. Defaults to the GMP-style character set.
        返回:
        a BytesBase62 instance.
      • createInstanceWithGmpCharacterSet

        public static BytesBase62 createInstanceWithGmpCharacterSet()
        Creates a BytesBase62 instance using the GMP-style character set.
        返回:
        a BytesBase62 instance.
      • createInstanceWithInvertedCharacterSet

        public static BytesBase62 createInstanceWithInvertedCharacterSet()
        Creates a BytesBase62 instance using the inverted character set.
        返回:
        a BytesBase62 instance.
      • 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 - when encoded is 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.
        返回:
        true when the bytes are encoded over a Base62 alphabet, false otherwise.