Class FileUtil
java.lang.Object
org.hsqldb.lib.FileUtil
- All Implemented Interfaces:
FileAccess
A collection of file management methods.
Also provides the default FileAccess implementation
- Since:
- 1.7.2
- Author:
- Campbell Burnet (campbell-burnet@users dot sourceforge.net), Fred Toussi (fredt@users dot sourceforge.net), Ocke Janssen oj@openoffice.org
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionfinal booleanfinal booleanFields inherited from interface FileAccess
ELEMENT_READ, ELEMENT_READWRITE, ELEMENT_SEEKABLEREAD, ELEMENT_TRUNCATE, ELEMENT_WRITE -
Method Summary
Modifier and TypeMethodDescriptionabsolutePath(String path) Retrieves the absolute path, given some path specification.Retrieves the canonical file for the given file, in a JDK 1.1 compliant way.canonicalFile(String path) Retrieves the canonical file for the given path, in a JDK 1.1 compliant way.Retrieves the canonical path for the given path, or the absolute path if attempting to retrieve the canonical path fails.Retrieves the canonical path for the given File, in a JDK 1.1 compliant way.canonicalPath(String path) Retrieves the canonical path for the given path, in a JDK 1.1 compliant way.voidcreateParentDirs(String filename) booleanDelete the named filevoiddeleteOnExit(File f) Requests, in a JDK 1.1 compliant way, that the file or directory denoted by the given abstract pathname be deleted when the virtual machine terminates.static booleandeleteOrRenameDatabaseFiles(String dbNamePath) Utility method for user applications.booleanReturn true or false based on whether the named file exists.booleanstatic File[]getDatabaseFileList(String dbNamePath) Utility method for user applications.static File[]getDatabaseMainFileList(String dbNamePath) Returns a list of existing main files for a database.static FileAccessgetFileAccess(boolean isResource) static FileUtilbooleanisStreamElement(String elementName) static StringmakeDirectories(String path) voidstatic StringnewDiscardFileName(String filename) openInputStreamElement(String streamName) openOutputStreamElement(String streamName) openOutputStreamElementAppend(String streamName) booleanremoveElement(String filename) booleanrenameElement(String oldName, String newName) booleanrenameElementOrCopy(String oldName, String newName, EventLogInterface logger)
-
Field Details
-
fsIsIgnoreCase
public final boolean fsIsIgnoreCase -
fsNormalizesPosixSeparator
public final boolean fsNormalizesPosixSeparator
-
-
Method Details
-
getFileUtil
-
getFileAccess
-
isStreamElement
- Specified by:
isStreamElementin interfaceFileAccess
-
openInputStreamElement
- Specified by:
openInputStreamElementin interfaceFileAccess- Throws:
IOException
-
createParentDirs
- Specified by:
createParentDirsin interfaceFileAccess
-
removeElement
- Specified by:
removeElementin interfaceFileAccess
-
renameElement
- Specified by:
renameElementin interfaceFileAccess
-
renameElementOrCopy
- Specified by:
renameElementOrCopyin interfaceFileAccess
-
openOutputStreamElement
- Specified by:
openOutputStreamElementin interfaceFileAccess- Throws:
IOException
-
openOutputStreamElementAppend
- Specified by:
openOutputStreamElementAppendin interfaceFileAccess- Throws:
IOException
-
delete
Delete the named file- Parameters:
filename- String- Returns:
- true if deleted
-
deleteOnExit
Requests, in a JDK 1.1 compliant way, that the file or directory denoted by the given abstract pathname be deleted when the virtual machine terminates.Deletion will be attempted only for JDK 1.2 and greater runtime environments and only upon normal termination of the virtual machine, as defined by the Java Language Specification.
Once deletion has been sucessfully requested, it is not possible to cancel the request. This method should therefore be used with care.
- Parameters:
f- the abstract pathname of the file be deleted when the virtual machine terminates
-
exists
Return true or false based on whether the named file exists.- Parameters:
filename- String- Returns:
- true if exists
-
exists
-
absolutePath
-
canonicalFile
Retrieves the canonical file for the given file, in a JDK 1.1 compliant way.- Parameters:
f- the File for which to retrieve the absolute File- Returns:
- the canonical File
- Throws:
IOException- on error
-
canonicalFile
Retrieves the canonical file for the given path, in a JDK 1.1 compliant way.- Parameters:
path- the path for which to retrieve the canonical File- Returns:
- the canonical File
- Throws:
IOException- on error
-
canonicalPath
Retrieves the canonical path for the given File, in a JDK 1.1 compliant way.- Parameters:
f- the File for which to retrieve the canonical path- Returns:
- the canonical path
- Throws:
IOException- on error
-
canonicalPath
Retrieves the canonical path for the given path, in a JDK 1.1 compliant way.- Parameters:
path- the path for which to retrieve the canonical path- Returns:
- the canonical path
- Throws:
IOException- on error
-
canonicalOrAbsolutePath
-
makeParentDirectories
-
makeDirectories
-
getFileSync
- Specified by:
getFileSyncin interfaceFileAccess- Throws:
IOException
-
deleteOrRenameDatabaseFiles
Utility method for user applications. Attempts to delete all the files for the database as listed by the getDatabaseFileList() method. If any of the current, main database files cannot be deleted, it is renamed by adding a suffix containing a hexadecimal timestamp portion and the ".old" extension. Also deletes the ".tmp" directory.- Parameters:
dbNamePath- full path or name of database (without a file extension)- Returns:
- currently always true
-
getDatabaseFileList
Utility method for user applications. Returns a list of files that currently exist for a database. The list includes current database files as well as ".new", and ".old" versions of the files, plus any app logs.- Parameters:
dbNamePath- full path or name of database (without a file extension)- Returns:
- File[]
-
getDatabaseMainFileList
-
newDiscardFileName
-