public class DRFileSystem extends Object implements FileSystem
Modifier and Type | Method and Description |
---|---|
static void |
cacheLocalFileSystem(FileClient client,
PathInfo pathInfo)
Forces the given client to cache a local DRFS
|
InputStream |
concat(List<Path> paths,
boolean ignoreNonExistant)
Returns an input stream consisting of the given list of paths concatenated together.
|
Path |
createDirectories(Path path)
Creates the directory identified by the given path,
creating any necessary parent directories.
|
Path |
createDirectory(Path path)
Creates the directory identified by the given path.
|
boolean |
createNewFile(Path path)
Creates the file identified by the given path, if
it doesn't already exist.
|
com.pervasive.datarush.cluster.DRFSPath |
createPath(String path) |
void |
delete(Path path,
boolean recursively)
Deletes the file or directory identified by the specified
path.
|
boolean |
equals(Object o) |
boolean |
exists(Path path)
Indicates whether the specified path represents an
existing file or directory.
|
PathDetails |
getDetails(Path path)
Returns metadata associated with the specified path.
|
String |
getFileSystemType(Path path)
Returns an identifier for the filesystem type.
|
Object |
getImplementation() |
long |
getLength(Path path)
Returns the length of the file represented by the given path.
|
FileSystemProvider |
getProvider()
Gets the provider for the path scheme associated
with the file system.
|
SplitIterator |
getSplits(Path path,
SplitOptions options)
Computes data splits over the specified file.
|
int |
hashCode() |
boolean |
isCreatable(Path path)
Indicates whether the specified path can be created.
|
boolean |
isDirectory(Path path)
Indicates whether the specified path represents a directory.
|
boolean |
isFile(Path path)
Indicates whether the specified path represents a file.
|
boolean |
isHidden(Path path)
Indicates whether the associated path is hidden by the file system.
|
boolean |
isReadable(Path path)
Indicates whether the specified path can be read.
|
boolean |
isWritable(Path path)
Indicates whether the specified path can be written.
|
List<PathDetails> |
listDirectory(Path path,
DirectoryFilter filter)
Gets the contents of the specified directory, applying
a filter.
|
List<PathDetails> |
matchPaths(String path)
Gets all paths which match the given pattern.
|
boolean |
move(FileSystem fromFS,
Path from,
Path to)
Moves a file or directory from one location to
another if possible.
|
FileChannel |
newFileChannel(Path path)
Opens the specified file for random access.
|
InputStream |
newInputStream(Path path)
Opens the specified file for reading.
|
OutputStream |
newOutputStream(Path path,
WriteMode mode)
Opens the specified file for writing.
|
boolean |
supportsConcat()
Returns whether this filesystem supports the
concat
method. |
boolean |
supportsDirectories()
Indicates whether the file system supports
directories.
|
boolean |
supportsRandomAccess()
Indicates whether the file system supports
random access to files.
|
String |
toString() |
public static void cacheLocalFileSystem(FileClient client, PathInfo pathInfo)
client
- the file clientpathInfo
- contains both remote and local locationpublic FileSystemProvider getProvider()
FileSystem
getProvider
in interface FileSystem
public boolean supportsRandomAccess()
FileSystem
If a file system does not support random access,
calling FileClient.newFileChannel(Path)
will
raise an error for paths referring to the file
system.
supportsRandomAccess
in interface FileSystem
true
if random access is supported,
false
otherwise.public boolean supportsDirectories()
FileSystem
supportsDirectories
in interface FileSystem
true
if directories are supported,
false
otherwise.public com.pervasive.datarush.cluster.DRFSPath createPath(String path)
public List<PathDetails> matchPaths(String path) throws IOException
FileSystem
matchPaths
in interface FileSystem
path
- the file pattern to useIOException
- if I/O errors occurpublic Path createDirectories(Path path)
FileSystem
createDirectories
in interface FileSystem
path
- the directory to createpublic Path createDirectory(Path path)
FileSystem
FileSystem.createDirectories(Path)
if nonexistent
parents need to be created.createDirectory
in interface FileSystem
path
- the directory to createpublic boolean createNewFile(Path path) throws IOException
FileSystem
FileSystem.createDirectories(Path)
if nonexistent
parents need to be created.createNewFile
in interface FileSystem
path
- the directory to createtrue
if the file was created,
false
if it already existed.IOException
- if I/O errors occur or if the
parent directory does not existpublic void delete(Path path, boolean recursively)
FileSystem
delete
in interface FileSystem
path
- the file or directory to deleterecursively
- indicates whether deletes of directories
should recursively delete the contentspublic InputStream newInputStream(Path path) throws FileNotFoundException
FileSystem
#listFiles(Path)
. The read starts at the first byte of the
(first) file. The returned stream is generally not buffered;
consult specific implementations for details.newInputStream
in interface FileSystem
path
- the file or directory to readFileNotFoundException
- if the specified path does not existpublic OutputStream newOutputStream(Path path, WriteMode mode) throws IOException
FileSystem
CREATE_NEW
, an
error is raised.OVERWRITE
, the
existing file is replaced with the byte written to the resulting
stream.APPEND
, the resulting
stream is positioned after the last byte of the existing file.The returned stream is generally not buffered; consult specific implementations for details.
newOutputStream
in interface FileSystem
path
- the file to writemode
- how to handle writes to existing filesIOException
- if I/O errors occur or if the target is
a directorypublic FileChannel newFileChannel(Path path) throws IOException
FileSystem
newFileChannel
in interface FileSystem
path
- the file or directory to readIOException
- if I/O errors occurFileNotFoundException
- if the specified path does not existpublic boolean exists(Path path)
FileSystem
exists
in interface FileSystem
path
- the path to testtrue
the path exists, false
otherwise.public PathDetails getDetails(Path path)
FileSystem
getDetails
in interface FileSystem
path
- the path for which to get metadatanull
if it does not exist.public boolean isDirectory(Path path)
FileSystem
isDirectory
in interface FileSystem
path
- the path to testtrue
the path represents a directory,public boolean isFile(Path path)
FileSystem
isFile
in interface FileSystem
path
- the path to testtrue
the path represents a file,public boolean isReadable(Path path)
FileSystem
isReadable
in interface FileSystem
path
- the path to testtrue
the path represents a readable
file or directory, false
otherwise.public boolean isWritable(Path path)
FileSystem
isWritable
in interface FileSystem
path
- the path to testtrue
the path represents a readable
file or directory, false
otherwise.public boolean isCreatable(Path path)
FileSystem
isCreatable
in interface FileSystem
path
- the path to testtrue
the path represents a nonexistent
file or directory which could be created, false
otherwise.public boolean isHidden(Path path) throws IOException
FileSystem
isHidden
in interface FileSystem
path
- the path to testtrue
if the path is hidden,
false
otherwise.IOException
- if I/O errors occurpublic SplitIterator getSplits(Path path, SplitOptions options) throws IOException
FileSystem
If a provider can provide locality information, it should, as this can be used to guide distributed execution.
getSplits
in interface FileSystem
path
- the file for which to get splitsoptions
- configuration for the process
of dividing the fileIOException
- if an I/O error occurspublic List<PathDetails> listDirectory(Path path, DirectoryFilter filter) throws IOException
FileSystem
listDirectory
in interface FileSystem
path
- the directory for which to get a filtered content listfilter
- a filter to apply to the contentsIOException
- if I/O errors occur or if the
path identifies a filepublic boolean move(FileSystem fromFS, Path from, Path to) throws IOException
FileSystem
move
in interface FileSystem
fromFS
- TODOfrom
- the source locationto
- the target locationIOException
- if I/O errors occurpublic long getLength(Path path) throws IOException
FileSystem
getLength
in interface FileSystem
path
- the path to testIOException
- if I/O errors occurpublic boolean supportsConcat()
FileSystem
concat
method.supportsConcat
in interface FileSystem
public InputStream concat(List<Path> paths, boolean ignoreNonExistant) throws IOException
FileSystem
concat
in interface FileSystem
paths
- the list of pathsignoreNonExistant
- whether to skip non-existent filesIOException
public String getFileSystemType(Path path)
FileSystem
getFileSystemType
in interface FileSystem
path
- the pathpublic Object getImplementation()
getImplementation
in interface FileSystem
Copyright © 2015 Actian Corporation. All Rights Reserved.