Package org.h2.dev.fs
Class FilePathZip2
java.lang.Object
org.h2.store.fs.FilePath
org.h2.dev.fs.FilePathZip2
This is a read-only file system that allows to access databases stored in a
.zip or .jar file. The problem of this file system is that data is always
accessed as a stream. This implementation allows to stack file systems.
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancanWrite()Check if the file is writable.voidCreate a directory (all required parent directories already exist).booleanCreate a new file.createTempFile(String suffix, boolean inTempDir) Create a new temporary file.voiddelete()Delete a file or directory if it exists.booleanexists()Checks if a file exists.Get the parent directory of a file or directory.Convert a file to a path.Get the scheme (prefix) for this file provider.booleanCheck if the file name includes a path.booleanCheck if it is a file or a directory.booleanCheck if it is a regular file.longGet the last modified date of a filevoidRename a file if this is allowed.List the files and directories in the given directory.Create an input stream to read from the file.newOutputStream(boolean append) Create an output stream to write into the file.Open a random access file object.static FilePathZip2register()Register the file system.booleanDisable the ability to write.longsize()Get the size of a file in bytesNormalize a file name.unwrap()Get the unwrapped file name (without wrapper prefixes if wrapping / delegating file systems are used).Methods inherited from class org.h2.store.fs.FilePath
get, getName, newFileChannelOutputStream, register, toString, unregister
-
Constructor Details
-
FilePathZip2
public FilePathZip2()
-
-
Method Details
-
register
Register the file system.- Returns:
- the instance
-
getPath
Description copied from class:FilePathConvert a file to a path. This is similar tojava.nio.file.spi.FileSystemProvider.getPath, but may return an object even if the scheme doesn't match in case of the default file provider. -
createDirectory
public void createDirectory()Description copied from class:FilePathCreate a directory (all required parent directories already exist).- Specified by:
createDirectoryin classFilePath
-
createFile
public boolean createFile()Description copied from class:FilePathCreate a new file.- Specified by:
createFilein classFilePath- Returns:
- true if creating was successful
-
createTempFile
Description copied from class:FilePathCreate a new temporary file.- Overrides:
createTempFilein classFilePath- Parameters:
suffix- the suffixinTempDir- if the file should be stored in the temporary directory- Returns:
- the name of the created file
- Throws:
IOException- on failure
-
delete
public void delete()Description copied from class:FilePathDelete a file or directory if it exists. Directories may only be deleted if they are empty. -
exists
public boolean exists()Description copied from class:FilePathChecks if a file exists. -
lastModified
public long lastModified()Description copied from class:FilePathGet the last modified date of a file- Specified by:
lastModifiedin classFilePath- Returns:
- the last modified date
-
getParent
Description copied from class:FilePathGet the parent directory of a file or directory. -
isAbsolute
public boolean isAbsolute()Description copied from class:FilePathCheck if the file name includes a path.- Specified by:
isAbsolutein classFilePath- Returns:
- if the file name is absolute
-
unwrap
Description copied from class:FilePathGet the unwrapped file name (without wrapper prefixes if wrapping / delegating file systems are used). -
isDirectory
public boolean isDirectory()Description copied from class:FilePathCheck if it is a file or a directory.- Specified by:
isDirectoryin classFilePath- Returns:
- true if it is a directory
-
isRegularFile
public boolean isRegularFile()Description copied from class:FilePathCheck if it is a regular file.- Specified by:
isRegularFilein classFilePath- Returns:
- true if it is a regular file
-
canWrite
public boolean canWrite()Description copied from class:FilePathCheck if the file is writable. -
setReadOnly
public boolean setReadOnly()Description copied from class:FilePathDisable the ability to write.- Specified by:
setReadOnlyin classFilePath- Returns:
- true if the call was successful
-
size
public long size()Description copied from class:FilePathGet the size of a file in bytes -
newDirectoryStream
Description copied from class:FilePathList the files and directories in the given directory.- Specified by:
newDirectoryStreamin classFilePath- Returns:
- the list of fully qualified file names
-
toRealPath
Description copied from class:FilePathNormalize a file name.- Specified by:
toRealPathin classFilePath- Returns:
- the normalized file name
-
newInputStream
Description copied from class:FilePathCreate an input stream to read from the file.- Overrides:
newInputStreamin classFilePath- Returns:
- the input stream
- Throws:
IOException- If an I/O error occurs
-
open
Description copied from class:FilePathOpen a random access file object.- Specified by:
openin classFilePath- Parameters:
mode- the access mode. Supported are r, rw, rws, rwd- Returns:
- the file object
- Throws:
IOException- If an I/O error occurs
-
newOutputStream
Description copied from class:FilePathCreate an output stream to write into the file.- Overrides:
newOutputStreamin classFilePath- Parameters:
append- if true, the file will grow, if false, the file will be truncated first- Returns:
- the output stream
-
moveTo
Description copied from class:FilePathRename a file if this is allowed. -
getScheme
Description copied from class:FilePathGet the scheme (prefix) for this file provider. This is similar tojava.nio.file.spi.FileSystemProvider.getScheme.
-