Top Description Fields Constructors Methods
org.h2.store.fs.zip

public Class FilePathZip

extends FilePath
Class Inheritance
Imports
java.io.FileNotFoundException, .IOException, .OutputStream, java.nio.channels.FileChannel, java.util.ArrayList, .Enumeration, java.util.zip.ZipEntry, .ZipFile, org.h2.message.DbException, org.h2.store.fs.FilePath, org.h2.store.fs.disk.FilePathDisk

This is a read-only file system that allows to access databases stored in a .zip or .jar file.

Field Summary

Inherited from org.h2.store.fs.FilePath:
name

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public boolean
canWrite()

Implements abstract org.h2.store.fs.FilePath.canWrite.

Check if the file is writable.

public void
createDirectory()

Implements abstract org.h2.store.fs.FilePath.createDirectory.

Create a directory (all required parent directories already exist).

public boolean
createFile()

Implements abstract org.h2.store.fs.FilePath.createFile.

Create a new file.

public FilePath
createTempFile(String
the suffix
suffix
,
boolean
if the file should be stored in the temporary directory
inTempDir
)

Overrides org.h2.store.fs.FilePath.createTempFile.

Create a new temporary file.

public void
delete()

Implements abstract org.h2.store.fs.FilePath.delete.

Delete a file or directory if it exists.

public boolean
exists()

Implements abstract org.h2.store.fs.FilePath.exists.

Checks if a file exists.

private String
public FilePath
getParent()

Implements abstract org.h2.store.fs.FilePath.getParent.

Get the parent directory of a file or directory.

public FilePathZip
getPath(String
the path
path
)

Implements abstract org.h2.store.fs.FilePath.getPath.

Convert a file to a path.

public String
getScheme()

Implements abstract org.h2.store.fs.FilePath.getScheme.

Get the scheme (prefix) for this file provider.

public boolean
isAbsolute()

Implements abstract org.h2.store.fs.FilePath.isAbsolute.

Check if the file name includes a path.

public boolean
isDirectory()

Implements abstract org.h2.store.fs.FilePath.isDirectory.

Check if it is a file or a directory.

public boolean
isRegularFile()

Implements abstract org.h2.store.fs.FilePath.isRegularFile.

Check if it is a regular file.

private boolean
isRegularOrDirectory(boolean directory)

public long
lastModified()

Implements abstract org.h2.store.fs.FilePath.lastModified.

Get the last modified date of a file

public void
moveTo(FilePath
the new fully qualified file name
newName
,
boolean
whether the move should be atomic, and the target file should be replaced if it exists and replacing is possible
atomicReplace
)

Implements abstract org.h2.store.fs.FilePath.moveTo.

Rename a file if this is allowed.

public ArrayList<FilePath>
newDirectoryStream()

Implements abstract org.h2.store.fs.FilePath.newDirectoryStream.

List the files and directories in the given directory.

public OutputStream
newOutputStream(boolean
if true, the file will grow, if false, the file will be truncated first
append
)

Overrides org.h2.store.fs.FilePath.newOutputStream.

Create an output stream to write into the file.

public FileChannel
open(String
the access mode. Supported are r, rw, rws, rwd
mode
)

Implements abstract org.h2.store.fs.FilePath.open.

Open a random access file object.

private ZipFile
public boolean
setReadOnly()

Implements abstract org.h2.store.fs.FilePath.setReadOnly.

Disable the ability to write.

public long
size()

Implements abstract org.h2.store.fs.FilePath.size.

Get the size of a file in bytes

public FilePath
toRealPath()

Implements abstract org.h2.store.fs.FilePath.toRealPath.

Normalize a file name.

private static String
public FilePath
unwrap()

Overrides org.h2.store.fs.FilePath.unwrap.

Get the unwrapped file name (without wrapper prefixes if wrapping / delegating file systems are used).

Inherited from org.h2.store.fs.FilePath:
getgetNamenewFileChannelOutputStreamnewInputStreamregistertoStringunregister

Constructor Detail

FilePathZipback to summary
public FilePathZip()

Method Detail

canWriteback to summary
public boolean canWrite()

Implements abstract org.h2.store.fs.FilePath.canWrite.

Doc from org.h2.store.fs.FilePath.canWrite.

Check if the file is writable.

Returns:boolean

if the file is writable

Annotations
@Override
createDirectoryback to summary
public void createDirectory()

Implements abstract org.h2.store.fs.FilePath.createDirectory.

Doc from org.h2.store.fs.FilePath.createDirectory.

Create a directory (all required parent directories already exist).

Annotations
@Override
createFileback to summary
public boolean createFile()

Implements abstract org.h2.store.fs.FilePath.createFile.

Doc from org.h2.store.fs.FilePath.createFile.

Create a new file.

Returns:boolean

true if creating was successful

Annotations
@Override
createTempFileback to summary
public FilePath createTempFile(String suffix, boolean inTempDir) throws IOException

Overrides org.h2.store.fs.FilePath.createTempFile.

Doc from org.h2.store.fs.FilePath.createTempFile.

Create a new temporary file.

Parameters
suffix:String

the suffix

inTempDir:boolean

if the file should be stored in the temporary directory

Returns:FilePath

the name of the created file

Annotations
@Override
Exceptions
IOException:
on failure
deleteback to summary
public void delete()

Implements abstract org.h2.store.fs.FilePath.delete.

Doc from org.h2.store.fs.FilePath.delete.

Delete a file or directory if it exists. Directories may only be deleted if they are empty.

Annotations
@Override
existsback to summary
public boolean exists()

Implements abstract org.h2.store.fs.FilePath.exists.

Doc from org.h2.store.fs.FilePath.exists.

Checks if a file exists.

Returns:boolean

true if it exists

Annotations
@Override
getEntryNameback to summary
private String getEntryName()
getParentback to summary
public FilePath getParent()

Implements abstract org.h2.store.fs.FilePath.getParent.

Doc from org.h2.store.fs.FilePath.getParent.

Get the parent directory of a file or directory.

Returns:FilePath

the parent directory name

Annotations
@Override
getPathback to summary
public FilePathZip getPath(String path)

Implements abstract org.h2.store.fs.FilePath.getPath.

Doc from org.h2.store.fs.FilePath.getPath.

Convert a file to a path. This is similar to java.nio.file.spi.FileSystemProvider.getPath, but may return an object even if the scheme doesn't match in case of the default file provider.

Parameters
path:String

the path

Returns:FilePathZip

the file path object

Annotations
@Override
getSchemeback to summary
public String getScheme()

Implements abstract org.h2.store.fs.FilePath.getScheme.

Doc from org.h2.store.fs.FilePath.getScheme.

Get the scheme (prefix) for this file provider. This is similar to java.nio.file.spi.FileSystemProvider.getScheme.

Returns:String

the scheme

Annotations
@Override
isAbsoluteback to summary
public boolean isAbsolute()

Implements abstract org.h2.store.fs.FilePath.isAbsolute.

Doc from org.h2.store.fs.FilePath.isAbsolute.

Check if the file name includes a path.

Returns:boolean

if the file name is absolute

Annotations
@Override
isDirectoryback to summary
public boolean isDirectory()

Implements abstract org.h2.store.fs.FilePath.isDirectory.

Doc from org.h2.store.fs.FilePath.isDirectory.

Check if it is a file or a directory.

Returns:boolean

true if it is a directory

Annotations
@Override
isRegularFileback to summary
public boolean isRegularFile()

Implements abstract org.h2.store.fs.FilePath.isRegularFile.

Doc from org.h2.store.fs.FilePath.isRegularFile.

Check if it is a regular file.

Returns:boolean

true if it is a regular file

Annotations
@Override
isRegularOrDirectoryback to summary
private boolean isRegularOrDirectory(boolean directory)
lastModifiedback to summary
public long lastModified()

Implements abstract org.h2.store.fs.FilePath.lastModified.

Doc from org.h2.store.fs.FilePath.lastModified.

Get the last modified date of a file

Returns:long

the last modified date

Annotations
@Override
moveToback to summary
public void moveTo(FilePath newName, boolean atomicReplace)

Implements abstract org.h2.store.fs.FilePath.moveTo.

Doc from org.h2.store.fs.FilePath.moveTo.

Rename a file if this is allowed.

Parameters
newName:FilePath

the new fully qualified file name

atomicReplace:boolean

whether the move should be atomic, and the target file should be replaced if it exists and replacing is possible

Annotations
@Override
newDirectoryStreamback to summary
public ArrayList<FilePath> newDirectoryStream()

Implements abstract org.h2.store.fs.FilePath.newDirectoryStream.

Doc from org.h2.store.fs.FilePath.newDirectoryStream.

List the files and directories in the given directory.

Returns:ArrayList<FilePath>

the list of fully qualified file names

Annotations
@Override
newOutputStreamback to summary
public OutputStream newOutputStream(boolean append) throws IOException

Overrides org.h2.store.fs.FilePath.newOutputStream.

Doc from org.h2.store.fs.FilePath.newOutputStream.

Create an output stream to write into the file.

Parameters
append:boolean

if true, the file will grow, if false, the file will be truncated first

Returns:OutputStream

the output stream

Annotations
@Override
Exceptions
IOException:
If an I/O error occurs
openback to summary
public FileChannel open(String mode) throws IOException

Implements abstract org.h2.store.fs.FilePath.open.

Doc from org.h2.store.fs.FilePath.open.

Open a random access file object.

Parameters
mode:String

the access mode. Supported are r, rw, rws, rwd

Returns:FileChannel

the file object

Annotations
@Override
Exceptions
IOException:
If an I/O error occurs
openZipFileback to summary
private ZipFile openZipFile() throws IOException
setReadOnlyback to summary
public boolean setReadOnly()

Implements abstract org.h2.store.fs.FilePath.setReadOnly.

Doc from org.h2.store.fs.FilePath.setReadOnly.

Disable the ability to write.

Returns:boolean

true if the call was successful

Annotations
@Override
sizeback to summary
public long size()

Implements abstract org.h2.store.fs.FilePath.size.

Doc from org.h2.store.fs.FilePath.size.

Get the size of a file in bytes

Returns:long

the size in bytes

Annotations
@Override
toRealPathback to summary
public FilePath toRealPath()

Implements abstract org.h2.store.fs.FilePath.toRealPath.

Doc from org.h2.store.fs.FilePath.toRealPath.

Normalize a file name.

Returns:FilePath

the normalized file name

Annotations
@Override
translateFileNameback to summary
private static String translateFileName(String fileName)
unwrapback to summary
public FilePath unwrap()

Overrides org.h2.store.fs.FilePath.unwrap.

Doc from org.h2.store.fs.FilePath.unwrap.

Get the unwrapped file name (without wrapper prefixes if wrapping / delegating file systems are used).

Returns:FilePath

the unwrapped path

Annotations
@Override