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 boolean
final boolean
Fields inherited from interface org.hsqldb.lib.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.void
createParentDirs
(String filename) boolean
Delete the named filevoid
deleteOnExit
(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 boolean
deleteOrRenameDatabaseFiles
(String dbNamePath) Utility method for user applications.boolean
Return true or false based on whether the named file exists.boolean
static 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 FileAccess
getFileAccess
(boolean isResource) static FileUtil
boolean
isStreamElement
(String elementName) static String
makeDirectories
(String path) void
static String
newDiscardFileName
(String filename) openInputStreamElement
(String streamName) openOutputStreamElement
(String streamName) openOutputStreamElementAppend
(String streamName) boolean
removeElement
(String filename) boolean
renameElement
(String oldName, String newName) boolean
renameElementOrCopy
(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:
isStreamElement
in interfaceFileAccess
-
openInputStreamElement
- Specified by:
openInputStreamElement
in interfaceFileAccess
- Throws:
IOException
-
createParentDirs
- Specified by:
createParentDirs
in interfaceFileAccess
-
removeElement
- Specified by:
removeElement
in interfaceFileAccess
-
renameElement
- Specified by:
renameElement
in interfaceFileAccess
-
renameElementOrCopy
- Specified by:
renameElementOrCopy
in interfaceFileAccess
-
openOutputStreamElement
- Specified by:
openOutputStreamElement
in interfaceFileAccess
- Throws:
IOException
-
openOutputStreamElementAppend
- Specified by:
openOutputStreamElementAppend
in 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
Retrieves the absolute path, given some path specification.- Parameters:
path
- the path for which to retrieve the absolute path- Returns:
- the absolute path
-
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
Retrieves the canonical path for the given path, or the absolute path if attempting to retrieve the canonical path fails.- Parameters:
path
- the path for which to retrieve the canonical or absolute path- Returns:
- the canonical or absolute path
-
makeParentDirectories
-
makeDirectories
-
getFileSync
- Specified by:
getFileSync
in 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
Returns a list of existing main files for a database. The list excludes non-essential files.- Parameters:
dbNamePath
- full path or name of database (without a file extension)- Returns:
- File[]
-
newDiscardFileName
-