org.jtool.jxplatform.io
Class JxplatformFile

java.lang.Object
  extended byjava.io.File
      extended byorg.jtool.jxplatform.io.JxplatformFile
All Implemented Interfaces:
java.lang.Comparable, java.io.Serializable

public class JxplatformFile
extends java.io.File

An abstract representation of a file or directory.

Author:
Katsuhisa Maruyama
See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.io.File
pathSeparator, pathSeparatorChar, separator, separatorChar
 
Constructor Summary
JxplatformFile(java.lang.String pathname)
          Creates a file or directory denoted by this pathname.
 
Method Summary
static java.lang.String changeExtension(java.lang.String pathname, java.lang.String ext)
          Obtains a pathname string of an extension of which was replaced with a new one.
 void deleteDir()
          Deletes a directory named by this pathname and its subdirectories.
static java.lang.String getRelativePath(java.lang.String pathname, java.lang.String basename)
          Obtains a pathname string of a given file relative to a base directory.
 void makeDir()
          Creates a directory for storing a file by this pathname.
 
Methods inherited from class java.io.File
canRead, canWrite, compareTo, compareTo, createNewFile, createTempFile, createTempFile, delete, deleteOnExit, equals, exists, getAbsoluteFile, getAbsolutePath, getCanonicalFile, getCanonicalPath, getName, getParent, getParentFile, getPath, hashCode, isAbsolute, isDirectory, isFile, isHidden, lastModified, length, list, list, listFiles, listFiles, listFiles, listRoots, mkdir, mkdirs, renameTo, setLastModified, setReadOnly, toString, toURI, toURL
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JxplatformFile

public JxplatformFile(java.lang.String pathname)
Creates a file or directory denoted by this pathname.

Parameters:
pathname - The path name of a file or directory.
Method Detail

makeDir

public void makeDir()
Creates a directory for storing a file by this pathname.


deleteDir

public void deleteDir()
Deletes a directory named by this pathname and its subdirectories.


getRelativePath

public static java.lang.String getRelativePath(java.lang.String pathname,
                                               java.lang.String basename)
Obtains a pathname string of a given file relative to a base directory.

Parameters:
pathname - The name of a file.
basename - The name of a base directory.
Returns:
The string of the relative pathname, or null if the file is not contained a base directory or its subdirectory.

changeExtension

public static java.lang.String changeExtension(java.lang.String pathname,
                                               java.lang.String ext)
Obtains a pathname string of an extension of which was replaced with a new one.

Parameters:
pathname - The name of a file.
ext - A new extension.
Returns:
The string of the replaced pathname. The extension is only added if the original filename does not have an extension.