Package org.apache.wicket.util
Class LongEncoder
- java.lang.Object
-
- org.apache.wicket.util.LongEncoder
-
public class LongEncoder extends Object
Encodes long values into the specified alphabet. Encoding is useful when long values need to be represented in their string form and shorter values are preferred; by using alphabets of length greater than ten shorter values can be obtained. For example, to encode values into their hexadecimal representations the0123456789ABCDEF-
can be used. Long values can be shortened even further by using longer alphabets. The last character in the alphabet is used as the negative sign.- Author:
- igor
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static long
decode(String value)
Decodes value using the default alphabet: "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"static long
decode(String value, String alphabet)
Decodes value using the specified alphabetstatic String
encode(long value)
Encodes the value into the default alphabet: "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"static String
encode(long value, String alphabet)
Encodes value into the specified alphabet
-
-
-
Field Detail
-
DEFAULT
public static final String DEFAULT
default alphabet that should be safe to use in most circumstances, while still providing good shortening of long values- See Also:
- Constant Field Values
-
-
Method Detail
-
encode
public static String encode(long value)
Encodes the value into the default alphabet: "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"- Parameters:
value
-- Returns:
- encoded value
-
decode
public static long decode(String value)
Decodes value using the default alphabet: "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"- Parameters:
value
-- Returns:
- decoded value
-
encode
public static String encode(long value, String alphabet)
Encodes value into the specified alphabet- Parameters:
value
-alphabet
-- Returns:
- encoded value
-
-