Stringprep

public class Stringprep

This class offers static methods for preparing internationalized strings. It supports the following stringprep profiles:

  • RFC3491 nameprep
  • RFC3920 XMPP nodeprep and resourceprep

Note that this implementation only supports 16-bit Unicode code points.

Methods

contains

static boolean contains(StringBuffer s, char[] p)

contains

static boolean contains(StringBuffer s, char[][] p)

contains

static boolean contains(char c, char[][] p)

filter

static void filter(StringBuffer s, char[] f)

filter

static void filter(StringBuffer s, char[][] f)

map

static void map(StringBuffer s, char[] search, String[] replace)

nameprep

public static String nameprep(String input)

Preps a name according to the Stringprep profile defined in RFC3491. Unassigned code points are not allowed.

Parameters:
  • input – the name to prep.
Throws:
Returns:

the prepped name.

nameprep

public static String nameprep(String input, boolean allowUnassigned)

Preps a name according to the Stringprep profile defined in RFC3491.

Parameters:
  • input – the name to prep.
  • allowUnassigned – true if the name may contain unassigned code points.
Throws:
Returns:

the prepped name.

nodeprep

public static String nodeprep(String input)

Preps a node name according to the Stringprep profile defined in RFC3920. Unassigned code points are not allowed.

Parameters:
  • input – the node name to prep.
Throws:
Returns:

the prepped node name.

nodeprep

public static String nodeprep(String input, boolean allowUnassigned)

Preps a node name according to the Stringprep profile defined in RFC3920.

Parameters:
  • input – the node name to prep.
  • allowUnassigned – true if the node name may contain unassigned code points.
Throws:
Returns:

the prepped node name.

resourceprep

public static String resourceprep(String input)

Preps a resource name according to the Stringprep profile defined in RFC3920. Unassigned code points are not allowed.

Parameters:
  • input – the resource name to prep.
Throws:
Returns:

the prepped node name.

resourceprep

public static String resourceprep(String input, boolean allowUnassigned)

Preps a resource name according to the Stringprep profile defined in RFC3920.

Parameters:
  • input – the resource name to prep.
  • allowUnassigned – true if the resource name may contain unassigned code points.
Throws:
Returns:

the prepped node name.