Perforce

com.perforce.api
Class Utils

java.lang.Object
  |
  +--com.perforce.api.Utils

public final class Utils
extends Object

Class that contains static utility methods.

Version:
$Date: 2002/05/15 $ $Revision: #5 $
Author:
David Markley
See Also:
HashDecay

Constructor Summary
Utils()
           
 
Method Summary
static void cleanUp()
          Cleans up after the package has been used.
static String commonPrefix(Enumeration en)
          Returns common prefix for an Enumeration of strings.
static String commonPrefix(Vector v)
          Returns common prefix for a Vector of strings.
static int getChangeFromPath(String path)
          Returns the change number portion of a depot path, if there is a valid one found.
static String HTMLEncode(String str)
          Returns the string encoded for HTML use.
static void initPackage()
          Initializes the package, in order to avoid some arbitrary JVM problems that have been encountered.
static boolean isMSJVM()
          Check to see if the current Java Virtual Machine is made by Microsoft
static boolean isWindows()
          Check to see if the current operating system is a Windows OS
static boolean wildPathMatch(String wildpath, String path)
          Returns true if the path matches the wildpath.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Utils

public Utils()
Method Detail

cleanUp

public static void cleanUp()
Cleans up after the package has been used. This stops any running threads and releases any objects for garbage collection.

commonPrefix

public static String commonPrefix(Enumeration en)
Returns common prefix for an Enumeration of strings.

commonPrefix

public static String commonPrefix(Vector v)
Returns common prefix for a Vector of strings. This is very useful for determining a commong prefix for a set of paths.

getChangeFromPath

public static final int getChangeFromPath(String path)
Returns the change number portion of a depot path, if there is a valid one found. Otherwise, it returns -1.

HTMLEncode

public static String HTMLEncode(String str)
Returns the string encoded for HTML use.

> becomes > and < becomes <


initPackage

public static void initPackage()
Initializes the package, in order to avoid some arbitrary JVM problems that have been encountered. This is a hack and should not have to be done if certain overbearing empires starting with the letter M built a fully compliant JVM.

isMSJVM

public static boolean isMSJVM()
Check to see if the current Java Virtual Machine is made by Microsoft
Returns:
boolean true if the java.vendor property comtains the word 'Microsoft'

isWindows

public static boolean isWindows()
Check to see if the current operating system is a Windows OS
Returns:
boolean true if the os.name property comtains the word 'Windows'

wildPathMatch

public static boolean wildPathMatch(String wildpath,
                                    String path)
Returns true if the path matches the wildpath. Only perforce wildcards are considered in the wildpath.

Perforce

Copyright © 2001, Perforce Software, All rights reserved.