nu.staldal.util
Class Utils

java.lang.Object
  extended by nu.staldal.util.Utils

public final class Utils
extends java.lang.Object

Some utility methods. All methods in this class are static.


Method Summary
static boolean absoluteURL(java.lang.String url)
          Check whether an URL is absolute.
static java.lang.String encodePath(java.lang.String path)
          Encode a path name or URL into a filename.
static java.lang.String encodePathAsIdentifier(java.lang.String path)
          Encode a path name or URL into a Java identifier.
static java.lang.String nChars(int n, char c)
          Generate a String with a specified number of a given character.
static boolean pseudoAbsoluteURL(java.lang.String url)
          Check whether an URL is pseudo-absolute.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

encodePath

public static java.lang.String encodePath(java.lang.String path)
Encode a path name or URL into a filename. The encoding function is not intended to be inversible.


encodePathAsIdentifier

public static java.lang.String encodePathAsIdentifier(java.lang.String path)
Encode a path name or URL into a Java identifier. The encoding function is not intended to be inversible.


absoluteURL

public static boolean absoluteURL(java.lang.String url)
Check whether an URL is absolute. Returns true if the URL contains at least one colon, and the first colon is before the first slash (if any).


pseudoAbsoluteURL

public static boolean pseudoAbsoluteURL(java.lang.String url)
Check whether an URL is pseudo-absolute. Returns true if the URL start with a slash.


nChars

public static java.lang.String nChars(int n,
                                      char c)
Generate a String with a specified number of a given character.