public class Hashids extends Object
This is implementation of http://hashids.org v1.0.0 version.
This implementation is immutable, thread-safe, no lock is necessary.
| 限定符和类型 | 字段和说明 |
|---|---|
static long |
MAX_NUMBER
Max number that can be encoded with Hashids.
|
| 构造器和说明 |
|---|
Hashids() |
Hashids(int minHashLength) |
Hashids(String salt) |
Hashids(String salt,
int minHashLength) |
Hashids(String salt,
int minHashLength,
String alphabet) |
| 限定符和类型 | 方法和说明 |
|---|---|
static int |
checkedCast(long value) |
long[] |
decode(String hash)
Decode string to numbers
|
String |
decodeHex(String hash)
Decode string to numbers
|
String |
encode(long... numbers)
Encode numbers to string
|
String |
encodeHex(String hexa)
Encode hexa to string
|
String |
getVersion()
Get Hashid algorithm version.
|
public static final long MAX_NUMBER
public Hashids()
public Hashids(int minHashLength)
public Hashids(String salt)
public Hashids(String salt, int minHashLength)
public String encode(long... numbers)
numbers - the numbers to encodepublic long[] decode(String hash)
hash - the encoded stringpublic String encodeHex(String hexa)
hexa - the hexa to encodepublic String decodeHex(String hash)
hash - the encoded stringpublic static int checkedCast(long value)
public String getVersion()
Copyright © 2021. All rights reserved.