|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.h2.store.fs.FilePath
public abstract class FilePath
A path to a file. It similar to the Java 7 java.nio.file.Path
,
but simpler, and works with older versions of Java. It also implements the
relevant methods found in java.nio.file.FileSystem
and
FileSystems
Field Summary | |
---|---|
protected java.lang.String |
name
The complete path (which may be absolute or relative, depending on the file system). |
Constructor Summary | |
---|---|
FilePath()
|
Method Summary | |
---|---|
abstract boolean |
canWrite()
Check if the file is writable. |
abstract void |
createDirectory()
Create a directory (all required parent directories already exist). |
abstract boolean |
createFile()
Create a new file. |
FilePath |
createTempFile(java.lang.String suffix,
boolean deleteOnExit,
boolean inTempDir)
Create a new temporary file. |
abstract void |
delete()
Delete a file or directory if it exists. |
abstract boolean |
exists()
Checks if a file exists. |
static FilePath |
get(java.lang.String path)
Get the file path object for the given path. |
java.lang.String |
getName()
Get the file or directory name (the last element of the path). |
protected static java.lang.String |
getNextTempFileNamePart(boolean newRandom)
Get the next temporary file name part (the part in the middle). |
abstract FilePath |
getParent()
Get the parent directory of a file or directory. |
abstract FilePath |
getPath(java.lang.String path)
Convert a file to a path. |
abstract java.lang.String |
getScheme()
Get the scheme (prefix) for this file provider. |
abstract boolean |
isAbsolute()
Check if the file name includes a path. |
abstract boolean |
isDirectory()
Check if it is a file or a directory. |
abstract long |
lastModified()
Get the last modified date of a file |
abstract void |
moveTo(FilePath newName)
Rename a file if this is allowed. |
abstract java.util.List<FilePath> |
newDirectoryStream()
List the files and directories in the given directory. |
abstract java.io.InputStream |
newInputStream()
Create an input stream to read from the file. |
abstract java.io.OutputStream |
newOutputStream(boolean append)
Create an output stream to write into the file. |
abstract java.nio.channels.FileChannel |
open(java.lang.String mode)
Open a random access file object. |
static void |
register(FilePath provider)
Register a file provider. |
abstract boolean |
setReadOnly()
Disable the ability to write. |
abstract long |
size()
Get the size of a file in bytes |
abstract FilePath |
toRealPath()
Normalize a file name. |
java.lang.String |
toString()
Get the string representation. |
static void |
unregister(FilePath provider)
Unregister a file provider. |
FilePath |
unwrap()
Get the unwrapped file name (without wrapper prefixes if wrapping / delegating file systems are used). |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected java.lang.String name
Constructor Detail |
---|
public FilePath()
Method Detail |
---|
public static FilePath get(java.lang.String path)
path
- the path
public static void register(FilePath provider)
provider
- the file providerpublic static void unregister(FilePath provider)
provider
- the file providerpublic abstract long size()
public abstract void moveTo(FilePath newName)
newName
- the new fully qualified file namepublic abstract boolean createFile()
public abstract boolean exists()
public abstract void delete()
public abstract java.util.List<FilePath> newDirectoryStream()
public abstract FilePath toRealPath()
public abstract FilePath getParent()
public abstract boolean isDirectory()
public abstract boolean isAbsolute()
public abstract long lastModified()
public abstract boolean canWrite()
public abstract void createDirectory()
public java.lang.String getName()
public abstract java.io.OutputStream newOutputStream(boolean append)
append
- if true, the file will grow, if false, the file will be
truncated first
public abstract java.nio.channels.FileChannel open(java.lang.String mode) throws java.io.IOException
mode
- the access mode. Supported are r, rw, rws, rwd
java.io.IOException
public abstract java.io.InputStream newInputStream() throws java.io.IOException
java.io.IOException
public abstract boolean setReadOnly()
public FilePath createTempFile(java.lang.String suffix, boolean deleteOnExit, boolean inTempDir) throws java.io.IOException
suffix
- the suffixdeleteOnExit
- if the file should be deleted when the virtual
machine existsinTempDir
- if the file should be stored in the temporary directory
java.io.IOException
protected static java.lang.String getNextTempFileNamePart(boolean newRandom)
newRandom
- if the random part of the filename should change
public java.lang.String toString()
toString
in class java.lang.Object
public abstract java.lang.String getScheme()
java.nio.file.spi.FileSystemProvider.getScheme
.
public abstract FilePath getPath(java.lang.String path)
java.nio.file.spi.FileSystemProvider.getPath
, but may
return an object even if the scheme doesn't match in case of the the
default file provider.
path
- the path
public FilePath unwrap()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |