Main Page | Packages | Class Hierarchy | Class List | Directories | File List | Class Members | Related Pages

Acme.Utils Class Reference

List of all members.

Detailed Description

Assorted static utility routines.

Definition at line 54 of file Utils.java.

Static Public Member Functions

static String lsDateStr (Date date)
static String pluralStr (long n)
 Returns "s" for numbers other than one, and "" for one.
static String intervalStr (long interval)
 Returns a string approximately describing a given time interval.
static int strSpan (String str, String charSet)
 Returns the length of the initial segment of str which consists.
static int strSpan (String str, String charSet, int fromIdx)
 Returns the length of the initial segment of str which consists.
static int strCSpan (String str, String charSet)
 Returns the length of the initial segment of str which consists.
static int strCSpan (String str, String charSet, int fromIdx)
 Returns the length of the initial segment of str which consists.
static boolean match (String pattern, String string)
 Checks whether a string matches a given wildcard pattern.
static int matchSpan (String pattern, String string)
 Finds the maximum length of a string that matches a given wildcard.
static int sameSpan (String str1, String str2)
 Returns the length of the initial segment of str1 that equals str2.
static int charCount (String str, char c)
 Returns the number of times the given character appears in the string.
static String[] splitStr (String str)
 Turns a String into an array of Strings, by using StringTokenizer.
static String[] splitStr (String str, char delim)
 Turns a String into an array of Strings, by splitting it at.
static String flattenStrarr (String[] strs)
 Turns an array of Strings into a single String, with the components.
static void sortStrings (String[] strings)
 Sorts an array of Strings.
static int indexOfString (String[] strings, String string)
 Locates a String in an array of Strings.
static int indexOfStringIgnoreCase (String[] strings, String string)
 Locates a String in an array of Strings, ignoring case.
static boolean equalsStrings (String[] strings1, String[] strings2)
 Compares two arrays of Strings for equality.
static long pow (long a, long b) throws ArithmeticException
 Returns the number a raised to the power of b. Long version.
static int parseInt (String str, int def)
 Parse an integer, returning a default value on errors.
static long parseLong (String str, long def)
 Parse a long, returning a default value on errors.
static String arrayToString (Object o)
 An array-to-String routine. Handles arrays of arbitrary.
static boolean instanceOf (Object o, Class cl)
 Check if an object extends a given class or one of its superclasses.
static boolean even (long n)
 Test is a number is even.
static boolean odd (long n)
 Test is a number is odd.
static int countOnes (byte n)
 Count the number of 1-bits in a byte.
static int countOnes (int n)
 Count the number of 1-bits in an int.
static int countOnes (long n)
 Count the number of 1-bits in a long.
static int read (InputStream in, byte[] b, int off, int len) throws IOException
 A fixed version of java.io.InputStream.read(byte[], int, int). The.
static int readFully (InputStream in, byte[] b, int off, int len) throws IOException
 A version of read that reads the entire requested block, instead.
static URL plainUrl (URL context, String urlStr) throws MalformedURLException
 Make a URL with no ref part and no query string. Also, if it's.
static URL plainUrl (String urlStr) throws MalformedURLException
 Make a URL with no ref part and no query string. Also, if it's.
static String baseUrlStr (String urlStr)
 Figure out the base URL for a given URL. What this means is.
static String fixDirUrlStr (String urlStr)
 Makes sure if a URL is a directory, it ends with a slash.
static boolean urlStrIsDir (String urlStr)
 Figures out whether a URL points to a directory or not.
static boolean urlStrIsAbsolute (String urlStr)
static String absoluteUrlStr (String urlStr, URL contextUrl) throws MalformedURLException
static String urlDecoder (String encoded)
 URLDecoder to go along with java.net.URLEncoder. Why there isn't.
static boolean arraycontains (Object[] array, Object element)
 Check if an array contains a given element.
static int system (String cmd)
 Run a program on the host system.
static InputStream popenr (String cmd)
 Run a program on the host system, and capture the output.
static OutputStream popenw (String cmd)
 Run a program on the host system, and send it some input.
static Process runCommand (String cmd) throws IOException
 Run a program on the host system.
static void copyStream (InputStream in, OutputStream out) throws IOException
 Copy the input to the output until EOF.
static void copyStream (Reader in, Writer out) throws IOException
 Copy the input to the output until EOF.
static void copyStream (InputStream in, Writer out) throws IOException
 Copy the input to the output until EOF.
static void copyStream (Reader in, OutputStream out) throws IOException
 Copy the input to the output until EOF.
static void dumpStack (PrintStream p)
 Dump out the current call stack.
static void dumpStack ()
 Dump out the current call stack onto System.err.
static void putAll (Hashtable _dest, Hashtable _src)
 add a hash table to a hash table

Static Public Attributes

static final long INT_SECOND = 1000L
static final long INT_MINUTE = INT_SECOND * 60L
static final long INT_HOUR = INT_MINUTE * 60L
static final long INT_DAY = INT_HOUR * 24L
static final long INT_WEEK = INT_DAY * 7L
static final long INT_MONTH = INT_DAY * 30L
static final long INT_YEAR = INT_DAY * 365L
static final long INT_DECADE = INT_DAY * 3652L

Static Package Functions

static int matchSpan1 (String pattern, String string)

Static Package Attributes

static final SimpleDateFormat shortfmt = new SimpleDateFormat("MMM dd HH:mm")
 Returns a date string formatted in Unix ls style - if it's within.
static final SimpleDateFormat longfmt = new SimpleDateFormat("MMM dd yyyy")


The documentation for this class was generated from the following file:
Generated on Wed Dec 14 21:05:36 2005 for OpenMobileIS by  doxygen 1.4.4