jxUtil 0.6

org.sourceforge.jxutil
Class StringEscape

java.lang.Object
  |
  +--org.sourceforge.jxutil.StringEscape

public final class StringEscape
extends Object

Escape the contents of a String for use in different environments.

Author:
Keve Müller

Field Summary
static char[] HEXDIGITS
          An array of lowercase hex digits for fast lookup.
static char[] HEXDIGITS_U
          An array of uppercase hex digits for fast lookup.
 
Constructor Summary
private StringEscape()
          Cannot instantiate.
 
Method Summary
static String escapeJava(String src)
          Escape a String to form a valid Java source string.
static String escapeURI(byte[] octets)
          Escape octet bytes into URI form.
static String escapeURI(String src)
          Escape a string into URI form.
static String unescapeJava(String src)
          Get the literal value of a String that was escaped in a Java source.
static String unescapeURI(String src)
          Unescape an URI encoded string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

HEXDIGITS

public static final char[] HEXDIGITS
An array of lowercase hex digits for fast lookup.


HEXDIGITS_U

public static final char[] HEXDIGITS_U
An array of uppercase hex digits for fast lookup.

Constructor Detail

StringEscape

private StringEscape()
Cannot instantiate.

Method Detail

escapeJava

public static String escapeJava(String src)
Escape a String to form a valid Java source string. This routine will use unicode escapes for all non Latin1 characters.

Parameters:
src - The original string.
Returns:
The string escaped for inclusion in a Java source file.

escapeURI

public static String escapeURI(byte[] octets)
Escape octet bytes into URI form.

Parameters:
octets - The original octets.
Returns:
The escaped String.

escapeURI

public static String escapeURI(String src)
Escape a string into URI form.

Parameters:
src - The original String.
Returns:
The escaped String.

unescapeJava

public static String unescapeJava(String src)
Get the literal value of a String that was escaped in a Java source.

Parameters:
src - The escaped string.
Returns:
The original string.

unescapeURI

public static String unescapeURI(String src)
Unescape an URI encoded string.

Parameters:
src - The escaped string.
Returns:
The original string.

jxUtil 0.6

Copyright © 2001,2002 Keve Müller, et al.; see LICENSE file for details.