org.apache.wicket.util
Class LongEncoder

java.lang.Object
  extended by org.apache.wicket.util.LongEncoder

public class LongEncoder
extends java.lang.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 the 0123456789ABCDEF- 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

Field Summary
static java.lang.String DEFAULT
          default alphabet that should be safe to use in most circumstances, while still providing good shortening of long values
 
Method Summary
static long decode(java.lang.String value)
          Decodes value using the default alphabet:
static long decode(java.lang.String value, java.lang.String alphabet)
          Decodes value using the specified alphabet
static java.lang.String encode(long value)
          Encodes the value into the default alphabet:
static java.lang.String encode(long value, java.lang.String alphabet)
          Encodes value into the specified alphabet
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT

public static java.lang.String DEFAULT
default alphabet that should be safe to use in most circumstances, while still providing good shortening of long values

Method Detail

encode

public static java.lang.String encode(long value)
Encodes the value into the default alphabet:

Parameters:
value -
Returns:
encoded value

decode

public static long decode(java.lang.String value)
Decodes value using the default alphabet:

Parameters:
value -
Returns:
decoded value

encode

public static java.lang.String encode(long value,
                                      java.lang.String alphabet)
Encodes value into the specified alphabet

Parameters:
value -
alphabet -
Returns:
encoded value

decode

public static long decode(java.lang.String value,
                          java.lang.String alphabet)
Decodes value using the specified alphabet

Parameters:
value -
alphabet -
Returns:
decoded value


Copyright © 2006-2011 Apache Software Foundation. All Rights Reserved.