|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectsidekick.ecmascript.parser.Util
public class Util
Collection of useful static utility methods.
| Constructor Summary | |
|---|---|
Util()
|
|
| Method Summary | |
|---|---|
static java.lang.String |
commonPathPrefix(java.lang.String path1,
java.lang.String path2)
Finds the common path prefix of two specified paths. |
static java.lang.String |
commonPrefix(java.lang.String str1,
java.lang.String str2)
Finds the common prefix of two specified strings. |
static void |
copyFile(java.lang.String srcFilename,
java.lang.String dstFilename)
Does a fast file copy from specified source to specified destination. |
static boolean |
endsWith(java.lang.String aString,
java.lang.String aSuffix)
Tests if specified string ends with the specified suffix. |
static java.lang.String |
escape2Html(java.lang.String plainString)
Escapes a plain text string for html. |
static java.lang.String |
getDateStamp()
Creates a string representing a date stamp of the current system date and system time. |
static boolean |
hasWildcards(java.lang.String filename)
Returns true if the specified filename has wildcard
characters in it, i.e. |
static boolean |
isJavaIdentifier(java.lang.String candidate)
Returns true if specified string is a valid identifier for
java or javascript. |
static boolean |
isLikelyIdentifier(java.lang.String candidate)
Returns true if specified string is a mixed case string
with case mixing happening in the middle of the string (starting with
uppercase char and continuing with all lowercase chars does count). |
static boolean |
isValidCompositeReference(java.lang.String candidate)
Returns true if specified string is a valid composite
reference where each part is a valid identifier for java or javascript. |
static boolean |
isWhitespace(java.lang.String candidate)
Returns true if specified string is whitespace |
static java.lang.String |
millisToNice(long millis)
Converts milliseconds to some more human readable representation. |
static java.nio.CharBuffer |
readBytes(java.io.InputStream inputStream,
java.nio.charset.CharsetDecoder decoder)
Reads an input stream completely into memory and returns a CharBuffer instance with the contents. |
static java.lang.String |
replaceSeparatedString(java.lang.String s,
java.lang.String sub,
java.lang.String with)
Replaces occurences of substring sub with string
with in specified string but only if substring is
delimited by non-alphanumeric characters. |
static java.lang.String |
replaceString(java.lang.String s,
java.lang.String sub,
java.lang.String with)
Replaces occurences of substring sub with string
with in specified string. |
static java.io.File |
resolveWebURL(java.lang.String urlPath,
java.lang.String webroot,
java.util.Map webmaps)
Resolves the specified url path to a file on the local file system. |
static java.lang.String[] |
tokenizeCommaSepString(java.lang.String aString)
Creates an array of strings from a string of comma-separated string tokens. |
static java.lang.String |
wildCard2Pattern(java.lang.String wildcard)
Transforms a user wildcard into a java.util.regex.Pattern pattern string. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Util()
| Method Detail |
|---|
public static final java.lang.String millisToNice(long millis)
millis - An amount of elapsed milliseconds
public static final java.lang.String[] tokenizeCommaSepString(java.lang.String aString)
aString - string containing tokens separated by ","
public static final java.lang.String commonPrefix(java.lang.String str1,
java.lang.String str2)
str1 - first stringstr2 - second string
public static final java.lang.String commonPathPrefix(java.lang.String path1,
java.lang.String path2)
path1 - first pathpath2 - second path
public static final void copyFile(java.lang.String srcFilename,
java.lang.String dstFilename)
throws java.io.IOException
srcFilename - file name of source filedstFilename - file name of copy
java.io.IOException - if an I/O error occurspublic static final java.lang.String getDateStamp()
public static final boolean isJavaIdentifier(java.lang.String candidate)
true if specified string is a valid identifier for
java or javascript.
candidate - potential identifier
true if it is in fact an identifierpublic static final boolean isValidCompositeReference(java.lang.String candidate)
true if specified string is a valid composite
reference where each part is a valid identifier for java or javascript.
candidate - potential identifier
true if it is in fact a valid composite referencepublic static final boolean isWhitespace(java.lang.String candidate)
true if specified string is whitespace
candidate - potential whitespace
true if it is in fact whitespacepublic static final boolean isLikelyIdentifier(java.lang.String candidate)
true if specified string is a mixed case string
with case mixing happening in the middle of the string (starting with
uppercase char and continuing with all lowercase chars does count).
candidate - potential mixed case
true if it is in fact mixed case
public static java.lang.String replaceString(java.lang.String s,
java.lang.String sub,
java.lang.String with)
sub with string
with in specified string.
s - string for replacementsub - substring to replacewith - substring to take its place
public static java.lang.String replaceSeparatedString(java.lang.String s,
java.lang.String sub,
java.lang.String with)
sub with string
with in specified string but only if substring is
delimited by non-alphanumeric characters.
s - string for replacementsub - substring to replacewith - substring to take its place
public static boolean endsWith(java.lang.String aString,
java.lang.String aSuffix)
aString - string to testaSuffix - suffix.
true if the ends in suffixpublic static boolean hasWildcards(java.lang.String filename)
true if the specified filename has wildcard
characters in it, i.e. the name contains either "*" or "?" characters.
filename - filename
true if has wildcard characterspublic static java.lang.String wildCard2Pattern(java.lang.String wildcard)
wildcard - wildcard string
public static java.io.File resolveWebURL(java.lang.String urlPath,
java.lang.String webroot,
java.util.Map webmaps)
urlPath - a url pathwebroot - directory path on local file system of the web rootwebmaps - web map aliases
public static java.nio.CharBuffer readBytes(java.io.InputStream inputStream,
java.nio.charset.CharsetDecoder decoder)
throws java.io.IOException
inputStream - an input streamdecoder - charset decoder
java.io.IOException - if reading from inputStream throws IOExceptionpublic static java.lang.String escape2Html(java.lang.String plainString)
plainString - plain text string
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||