net.jbeans.io
Class FilenameUtil

java.lang.Object
  extended bynet.jbeans.io.FilenameUtil

public final class FilenameUtil
extends java.lang.Object

FilenameUtil defines several useful method to manipulate filename.

Version:
$Revision: 1.1.1.1 $
Author:
Masahiro Takatsuka (masa@jbeans.net)

Field Summary
static java.lang.String pathSeparator
          The system-dependent path-separator character, represented as a string for convenience.
static char pathSeparatorChar
          The system-dependent path-separator character.
static java.lang.String separator
          The system-dependent default name-separator character, represented as a string for convenience.
static char separatorChar
          The system-dependent default name-separator character.
 
Method Summary
static java.lang.String changeSuffix(java.lang.String filename, java.lang.String suffix)
           
static java.lang.String getBaseName(java.lang.String filename)
          returns a filename without a suffix.
static java.lang.String getExtension(java.lang.String filename)
           
static java.lang.String getName(java.lang.String path)
          Returns the name of the file or directory denoted by this abstract pathname.
static java.lang.String getSuffix(java.lang.String filename)
          returns a suffix of the specified filename.
static java.io.File setSuffix(java.io.File file, java.lang.String suffix)
           
static java.lang.String setSuffix(java.lang.String filename, java.lang.String suffix)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

separatorChar

public static final char separatorChar
The system-dependent default name-separator character. This field is initialized to contain the first character of the value of the system property file.separator. On UNIX systems the value of this field is '/'; on Win32 systems it is '\'.

See Also:
System.getProperty(java.lang.String)

separator

public static final java.lang.String separator
The system-dependent default name-separator character, represented as a string for convenience. This string contains a single character, namely separatorChar.


pathSeparatorChar

public static final char pathSeparatorChar
The system-dependent path-separator character. This field is initialized to contain the first character of the value of the system property path.separator. This character is used to separate filenames in a sequence of files given as a path list. On UNIX systems, this character is ':'; on Win32 systems it is ';'.

See Also:
System.getProperty(java.lang.String)

pathSeparator

public static final java.lang.String pathSeparator
The system-dependent path-separator character, represented as a string for convenience. This string contains a single character, namely pathSeparatorChar.

Method Detail

getName

public static final java.lang.String getName(java.lang.String path)
Returns the name of the file or directory denoted by this abstract pathname. This is just the last name in the pathname's name sequence. If the pathname's name sequence is empty, then the empty string is returned.

Returns:
The name of the file or directory denoted by this abstract pathname, or the empty string if this pathname's name sequence is empty

getSuffix

public static final java.lang.String getSuffix(java.lang.String filename)
returns a suffix of the specified filename.
  Example: String suffix = StringUtil.getSuffix(filename);
 

Parameters:
filename - a filename.
Returns:
a suffix.

getExtension

public static final java.lang.String getExtension(java.lang.String filename)

getBaseName

public static final java.lang.String getBaseName(java.lang.String filename)
returns a filename without a suffix.
  Example: String suffix = StringUtil.getBaseName(filename);
 

Parameters:
filename - a filename.
Returns:
a base name.

changeSuffix

public static final java.lang.String changeSuffix(java.lang.String filename,
                                                  java.lang.String suffix)

setSuffix

public static final java.lang.String setSuffix(java.lang.String filename,
                                               java.lang.String suffix)

setSuffix

public static final java.io.File setSuffix(java.io.File file,
                                           java.lang.String suffix)


Copyright © 2003 JBean project. All Rights Reserved.