|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.File
filesystem.FileExtended
public class FileExtended
Extends File to provide features missing from the Sun File class. Also, features a copy and delete (for file and dir) operation.
Field Summary |
---|
Fields inherited from class java.io.File |
---|
pathSeparator, pathSeparatorChar, separator, separatorChar |
Constructor Summary | |
---|---|
FileExtended(FileExtended parent,
java.lang.String file)
Calls the File constructor |
|
FileExtended(java.io.File parent,
java.lang.String fileName)
Constructor. |
|
FileExtended(java.lang.String pathname)
Calls the File constructor |
|
FileExtended(java.lang.String parent,
java.lang.String fileName)
Constructor. |
Method Summary | |
---|---|
static void |
copy(java.io.File destDir,
java.io.File srcFile)
Copies a file or directory to dest dir. |
boolean |
delete()
Deletes this file/directory. |
java.lang.String |
getHomeDir()
Returns the drive name where this file is. |
java.lang.String |
getNameWithoutExtension()
Returns the name of the file as defined by File.getName() without any attached extension. |
int |
getPageNumber()
Given any filename, returns any series of digits in that filename. |
static int |
getPageNumber(java.lang.String s)
|
java.lang.String |
getPageNumberPrefix()
Returns page number prefix. |
static java.util.ArrayList<java.io.File> |
listAllFiles(java.io.File dicFile)
Returns all files in a directory. |
java.io.File[] |
listFiles()
Overrides listFiles in File#listFiles() to only accept files that are not named "CVS". |
java.io.File[] |
listFiles(java.lang.String extension)
Finds all files in a dir. |
static java.io.File |
removeExtension(java.io.File element)
Given any filename, returns the same file but without the extension(if any) |
Methods inherited from class java.io.File |
---|
canRead, canWrite, compareTo, createNewFile, createTempFile, createTempFile, deleteOnExit, equals, exists, getAbsoluteFile, getAbsolutePath, getCanonicalFile, getCanonicalPath, getName, getParent, getParentFile, getPath, hashCode, isAbsolute, isDirectory, isFile, isHidden, lastModified, length, list, list, listFiles, listFiles, listRoots, mkdir, mkdirs, renameTo, setLastModified, setReadOnly, toString, toURI, toURL |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public FileExtended(java.lang.String pathname)
pathname
- public FileExtended(java.io.File parent, java.lang.String fileName)
parent
- parent directoryfileName
- the name of the filepublic FileExtended(java.lang.String parent, java.lang.String fileName)
parent
- parent directoryfileName
- the name of the filepublic FileExtended(FileExtended parent, java.lang.String file)
Method Detail |
---|
public java.io.File[] listFiles(java.lang.String extension)
File class File#listFiles(FileFilter) for more details
public java.lang.String getNameWithoutExtension()
public java.io.File[] listFiles()
listFiles
in class java.io.File
File.listFiles()
public boolean delete()
delete
in class java.io.File
for more details about deleting a file
public static void copy(java.io.File destDir, java.io.File srcFile) throws java.io.FileNotFoundException, java.io.IOException
destDir
- Complete path to the destination directorysrcFile
- Complete path to the source file/directory
java.io.FileNotFoundException
- Throws FileNotFoundException if srcFile not found
java.io.IOException
- Throws IOException if destDir not absolute or does not existpublic static java.io.File removeExtension(java.io.File element)
element
-
public static int getPageNumber(java.lang.String s)
public int getPageNumber()
Example: for ce001, returns 1 for ce0001-002, returns 1 for ce21dd, returns 21 for 21dd, returns 21 for cebdef return -1
public java.lang.String getPageNumberPrefix()
public java.lang.String getHomeDir()
public static java.util.ArrayList<java.io.File> listAllFiles(java.io.File dicFile)
If a file is passed to this function instead of a directory, only that file is returned.
fileName
- Name of the directory
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |