gnu.inet.encoding

Class Punycode


public class Punycode
extends java.lang.Object

This class offers static methods for encoding/decoding strings using the Punycode algorithm. Note that this implementation only supports 16-bit Unicode code points.

Method Summary

static int
adapt(int delta, int numpoints, boolean first)
static int
codepoint2digit(int c)
static String
decode(String input)
Decode a punycoded string.
static int
digit2codepoint(int d)
static String
encode(String input)
Punycodes a unicode string.
static boolean
isBasic(char c)

Method Details

adapt

public static final int adapt(int delta,
                              int numpoints,
                              boolean first)

codepoint2digit

public static final int codepoint2digit(int c)
            throws PunycodeException

decode

public static String decode(String input)
            throws PunycodeException
Decode a punycoded string.
Parameters:
input - Punycode string
Returns:
Unicode string.

digit2codepoint

public static final int digit2codepoint(int d)
            throws PunycodeException

encode

public static String encode(String input)
            throws PunycodeException
Punycodes a unicode string.
Parameters:
input - Unicode string.
Returns:
Punycoded string.

isBasic

public static final boolean isBasic(char c)