org.apache.beehive.netui.util
Class FileUtils

Object
  extended by FileUtils

public class FileUtils
extends Object


Constructor Summary
FileUtils()
           
 
Method Summary
static String getFileExtension(String filename)
          Get the file extension from a file name.
static boolean isAbsoluteURI(String uri)
          Tell whether a given URI is absolute, i.e., whether it contains a scheme-part (e.g., "http:").
static boolean isOSCaseSensitive()
          Tell whether the current operating system is case-sensitive with regard to file names.
static boolean osSensitiveEndsWith(String str, String suffix)
          Tell whether a string ends with a particular suffix, with case sensitivity determined by the operating system.
static boolean osSensitiveEquals(String s1, String s2)
          Compare two strings, with case sensitivity determined by the operating system.
static String stripFileExtension(String filename)
           
static boolean uriEndsWith(String uri, String ending)
          Tell whether a URI ends in a given String.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileUtils

public FileUtils()
Method Detail

isAbsoluteURI

public static boolean isAbsoluteURI(String uri)
Tell whether a given URI is absolute, i.e., whether it contains a scheme-part (e.g., "http:").

Parameters:
uri - the URI to test.
Returns:
true if the given URI is absolute.

uriEndsWith

public static boolean uriEndsWith(String uri,
                                  String ending)
Tell whether a URI ends in a given String.


getFileExtension

public static String getFileExtension(String filename)
Get the file extension from a file name.

Parameters:
filename - the file name.
Returns:
the file extension (everything after the last '.'), or the empty string if there is no file extension.

stripFileExtension

public static String stripFileExtension(String filename)

isOSCaseSensitive

public static boolean isOSCaseSensitive()
Tell whether the current operating system is case-sensitive with regard to file names.


osSensitiveEquals

public static boolean osSensitiveEquals(String s1,
                                        String s2)
Compare two strings, with case sensitivity determined by the operating system.

Parameters:
s1 - the first String to compare.
s2 - the second String to compare.
Returns:
true when:
  • the strings match exactly (including case), or,
  • the operating system is not case-sensitive with regard to file names, and the strings match, ignoring case.
See Also:
isOSCaseSensitive()

osSensitiveEndsWith

public static boolean osSensitiveEndsWith(String str,
                                          String suffix)
Tell whether a string ends with a particular suffix, with case sensitivity determined by the operating system.

Parameters:
str - the String to test.
suffix - the suffix to look for.
Returns:
true when:
  • str ends with suffix, or,
  • the operating system is not case-sensitive with regard to file names, and str ends with suffix, ignoring case.
See Also:
isOSCaseSensitive()