|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.limegroup.gnutella.util.CommonUtils
This class handles common utility functions that many classes may want to access.
Field Summary | |
static java.lang.String |
QHD_VENDOR_NAME
The vendor code for QHD and GWebCache. |
Method Summary | |
static boolean |
canLaunchFileWithQuickTime(java.io.File file)
Convenience method that checks both that the QuickTime for Java libraries are available and that we can launch the specified file using QuickTime. |
static int |
compare(java.lang.Object o1,
java.lang.Object o2)
Convenience method to generically compare any two comparable things. |
static java.lang.String |
convertFileName(java.lang.String name)
Replaces OS specific illegal characters from any filename with '_', including ( / \n \r \t ) on all operating systems, ( ? * \ < > | " ) on Windows, ( ` ) on unix. |
static boolean |
copy(java.io.File src,
java.io.File dst)
Copies the file 'src' to 'dst', returning true iff the copy succeeded. |
static int |
copy(java.io.File src,
int amount,
java.io.File dst)
Attempts to copy the first 'amount' bytes of file 'src' to 'dst', returning the number of bytes actually copied. |
static void |
copyResourceFile(java.lang.String fileName)
Copies the specified resource file into the current directory from the jar file. |
static void |
copyResourceFile(java.lang.String fileName,
java.io.File newFile)
Copies the specified resource file into the current directory from the jar file. |
static void |
copyResourceFile(java.lang.String fileName,
java.io.File newFile,
boolean forceOverwrite)
Copies the specified resource file into the current directory from the jar file. |
static java.lang.String |
decode(java.lang.String s)
Copied from URLDecoder.java |
static java.io.File |
getCurrentDirectory()
Returns the user's current working directory as a File instance, or null if the property is not set. |
static int |
getGUESSMajorVersionNumber()
Gets the major version of GUESS supported. |
static int |
getGUESSMinorVersionNumber()
Gets the minor version of GUESS supported. |
static java.lang.String |
getHttpServer()
Returns the string for the server that should be reported in the HTTP "Server: " tag. |
static java.lang.String |
getJavaVersion()
Returns the version of java we're using. |
static java.lang.String |
getLimeWireVersion()
Returns the current version number of LimeWire as a string, e.g., "1.4". |
static int |
getMajorVersionNumber()
Gets the major version of LimeWire. |
static int |
getMinorVersionNumber()
Gets the minor version of LimeWire. |
static java.lang.String |
getOS()
Returns the operating system. |
static java.lang.String |
getOSVersion()
Returns the operating system version. |
static java.io.File |
getResourceFile(java.lang.String location)
Gets a resource file using the CommonUtils class loader, or the system class loader if CommonUtils isn't loaded. |
static int |
getUPMajorVersionNumber()
Gets the major version of Ultrapeer Protocol supported. |
static int |
getUPMinorVersionNumber()
Gets the minor version of Ultrapeer Protocol supported. |
static java.io.File |
getUserHomeDir()
Returns the user home directory. |
static java.lang.String |
getUserName()
Return the user's name. |
static java.io.File |
getUserSettingsDir()
Returns the directory where all user settings should be stored. |
static java.lang.String |
getVendor()
Returns a version number appropriate for upload headers. |
static boolean |
isAnyMac()
Returns whether or not the os is any Mac os. |
static boolean |
isJaguarOrAbove()
Returns whether or not the os is Mac OSX 10.2 or above. |
static boolean |
isJava118()
Returns whether or not the current JVM is a 1.1.8 implementation. |
static boolean |
isJava13OrLater()
Returns whether or not the current JVM is 1.3.x or later |
static boolean |
isJava14OrLater()
Returns whether or not the current JVM is 1.4.x or later |
static boolean |
isLinux()
Returns whether or not the os is Linux. |
static boolean |
isMacClassic()
Returns whether or not the os is Mac 9.1 or earlier. |
static boolean |
isMacOSX()
Returns whether or not the os is Mac OSX. |
static boolean |
isPro()
Accessor for whether or not this is LimeWire pro. |
static boolean |
isQuickTimeAvailable()
Returns whether or not the QuickTime libraries are available on the user's system. |
static boolean |
isQuickTimeSupportedFormat(java.io.File file)
Returns whether or not the specified file extension is supported in our implementation of QuickTime. |
static boolean |
isSolaris()
Returns whether or not the os is Solaris. |
static boolean |
isTestingVersion()
Accessor for whether or not this is a testing version (3.5.6-3jpp) of LimeWire. |
static boolean |
isUltrapeerOS()
Returns whether or not this operating system is considered capable of meeting the requirements of a ultrapeer. |
static boolean |
isUnix()
Returns whether or not the os is some version of Unix, defined here as only Solaris or Linux. |
static boolean |
isWindows()
Returns whether or not the os is some version of Windows. |
static boolean |
isWindows2000orXP()
Returns whether or not the os is 2000 or XP. |
static boolean |
isWindowsNTor2000orXP()
Returns whether or not the os is Windows NT, 2000, or XP. |
static boolean |
supportsTray()
Returns true if this is Windows NT or Windows 2000 and hence can support a system tray feature. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String QHD_VENDOR_NAME
Method Detail |
public static int getGUESSMajorVersionNumber()
public static int getGUESSMinorVersionNumber()
public static int getUPMajorVersionNumber()
public static int getUPMinorVersionNumber()
public static java.lang.String getLimeWireVersion()
public static int getMajorVersionNumber()
public static int getMinorVersionNumber()
public static boolean isPro()
public static boolean isTestingVersion()
public static java.lang.String getVendor()
public static java.lang.String getHttpServer()
public static java.lang.String getJavaVersion()
public static java.lang.String getOS()
public static java.lang.String getOSVersion()
public static java.io.File getCurrentDirectory()
public static boolean supportsTray()
public static boolean isUltrapeerOS()
public static boolean isWindows()
public static boolean isWindowsNTor2000orXP()
public static boolean isWindows2000orXP()
public static boolean isMacClassic()
public static boolean isMacOSX()
public static boolean isJaguarOrAbove()
public static boolean isAnyMac()
public static boolean isSolaris()
public static boolean isLinux()
public static boolean isUnix()
public static boolean isJava118()
public static boolean isJava13OrLater()
public static boolean isJava14OrLater()
public static int copy(java.io.File src, int amount, java.io.File dst)
src
- the source file to copyamount
- the amount of src to copy, in bytesdst
- the place to copy the file
public static boolean copy(java.io.File src, java.io.File dst)
public static java.io.File getUserHomeDir()
public static java.lang.String getUserName()
public static java.io.File getUserSettingsDir()
public static boolean isQuickTimeAvailable()
public static boolean isQuickTimeSupportedFormat(java.io.File file)
public static boolean canLaunchFileWithQuickTime(java.io.File file)
public static int compare(java.lang.Object o1, java.lang.Object o2)
public static java.io.File getResourceFile(java.lang.String location)
public static java.lang.String decode(java.lang.String s)
public static void copyResourceFile(java.lang.String fileName)
fileName
- the name of the file to copy, relative to the jar
file -- such as "com/limegroup/gnutella/gui/images/image.gif"public static void copyResourceFile(java.lang.String fileName, java.io.File newFile)
fileName
- the name of the file to copy, relative to the jar
file -- such as "com/limegroup/gnutella/gui/images/image.gif"newFile
- the new File instance where the resource file
will be copied topublic static void copyResourceFile(java.lang.String fileName, java.io.File newFile, boolean forceOverwrite)
fileName
- the name of the file to copy, relative to the jar
file -- such as "com/limegroup/gnutella/gui/images/image.gif"newFile
- the new File instance where the resource file
will be copied to -- if this argument is null, the file will be
copied to the current directoryforceOverwrite
- specifies whether or not to overwrite the
file if it already existspublic static java.lang.String convertFileName(java.lang.String name)
name
- the filename to check for illegal characters
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |