java.lang.Object
com.pervasive.datarush.gcp.GcpFileSystem
- All Implemented Interfaces:
FileSystem
-
Method Summary
Modifier and TypeMethodDescriptionReturns an input stream consisting of the given list of paths concatenated together.createDirectories(Path path) Creates the directory identified by the given path, creating any necessary parent directories.createDirectory(Path path) Creates the directory identified by the given path.booleancreateNewFile(Path path) Creates the file identified by the given path, if it doesn't already exist.voidDeletes the file or directory identified by the specified path.booleanIndicates whether the specified path represents an existing file or directory.getDetails(Path path) Returns metadata associated with the specified path.getFileSystemType(Path path) Returns an identifier for the filesystem type.longReturns the length of the file represented by the given path.Gets the provider for the path scheme associated with the file system.getSplits(Path path, SplitOptions options) Computes data splits over the specified file.booleanisCreatable(Path path) Indicates whether the specified path can be created.booleanisDirectory(Path path) Indicates whether the specified path represents a directory.booleanIndicates whether the specified path represents a file.booleanIndicates whether the associated path is hidden by the file system.booleanisReadable(Path path) Indicates whether the specified path can be read.booleanisWritable(Path path) Indicates whether the specified path can be written.listDirectory(Path path, DirectoryFilter filter) Gets the contents of the specified directory, applying a filter.matchPaths(String pattern) Gets all paths which match the given pattern.booleanmove(FileSystem fromFS, Path from, Path to) Moves a file or directory from one location to another if possible.newFileChannel(Path path) Opens the specified file for random access.newInputStream(Path path) Opens the specified file for reading.newOutputStream(Path path, WriteMode mode) Opens the specified file for writing.booleanReturns whether this filesystem supports theconcatmethod.booleanIndicates whether the file system supports directories.booleanIndicates whether the file system supports random access to files.
-
Method Details
-
getFileSystemType
Description copied from interface:FileSystemReturns an identifier for the filesystem type. This identifier is used for reporting statistics to be able to distinguish local from non-local io.- Specified by:
getFileSystemTypein interfaceFileSystem- Parameters:
path- the path- Returns:
- a unique identifier
-
getProvider
Description copied from interface:FileSystemGets the provider for the path scheme associated with the file system.- Specified by:
getProviderin interfaceFileSystem- Returns:
- the associated provider object
-
supportsRandomAccess
public boolean supportsRandomAccess()Description copied from interface:FileSystemIndicates whether the file system supports random access to files.If a file system does not support random access, calling
FileClient.newFileChannel(Path)will raise an error for paths referring to the file system.- Specified by:
supportsRandomAccessin interfaceFileSystem- Returns:
trueif random access is supported,falseotherwise.
-
supportsDirectories
public boolean supportsDirectories()Description copied from interface:FileSystemIndicates whether the file system supports directories.- Specified by:
supportsDirectoriesin interfaceFileSystem- Returns:
trueif directories are supported,falseotherwise.
-
matchPaths
Description copied from interface:FileSystemGets all paths which match the given pattern. Patterns may be scheme-specific; refer to the provider implementation of a specific scheme to determine valid pattern syntax.- Specified by:
matchPathsin interfaceFileSystem- Parameters:
pattern- the file pattern to use- Returns:
- all paths matching the pattern
- Throws:
IOException- if I/O errors occur
-
createDirectories
Description copied from interface:FileSystemCreates the directory identified by the given path, creating any necessary parent directories.- Specified by:
createDirectoriesin interfaceFileSystem- Parameters:
path- the directory to create- Returns:
- the path to the directory
- Throws:
IOException- if I/O errors occur
-
createDirectory
Description copied from interface:FileSystemCreates the directory identified by the given path. All parent directories must already exist. UseFileSystem.createDirectories(Path)if nonexistent parents need to be created.- Specified by:
createDirectoryin interfaceFileSystem- Parameters:
path- the directory to create- Returns:
- the path to the directory
- Throws:
IOException- if I/O errors occur or if the parent directory does not exist
-
createNewFile
Description copied from interface:FileSystemCreates the file identified by the given path, if it doesn't already exist. All parent directories must already exist. UseFileSystem.createDirectories(Path)if nonexistent parents need to be created.- Specified by:
createNewFilein interfaceFileSystem- Parameters:
path- the directory to create- Returns:
trueif the file was created,falseif it already existed.- Throws:
IOException- if I/O errors occur or if the parent directory does not exist
-
delete
Description copied from interface:FileSystemDeletes the file or directory identified by the specified path. If the path is a directory, the contents will be deleted recursively as indicated. It is not an error to delete a non-existent path.- Specified by:
deletein interfaceFileSystem- Parameters:
path- the file or directory to deleterecursively- indicates whether deletes of directories should recursively delete the contents- Throws:
IOException- if I/O errors occur or if the path identifies a non-empty directory and a recursive delete was not requested
-
move
Description copied from interface:FileSystemMoves a file or directory from one location to another if possible.- Specified by:
movein interfaceFileSystem- Parameters:
fromFS- the source filesystemfrom- the source locationto- the target location- Returns:
- true if a move was possible (otherwise caller should fall back to copy-and-delete)
- Throws:
IOException- if I/O errors occur
-
newInputStream
Description copied from interface:FileSystemOpens the specified file for reading. If the path identifies a directory, all files in the directory are read as a concatenated stream, in the order they are returned by#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.- Specified by:
newInputStreamin interfaceFileSystem- Parameters:
path- the file or directory to read- Returns:
- a stream for reading the contents of the path
- Throws:
IOException- if I/O errors occurFileNotFoundException- if the specified path does not exist
-
newOutputStream
Description copied from interface:FileSystemOpens the specified file for writing. Behavior depends on the provided mode and whether the target file exists. If the target file does not exist, it is created and the resulting stream is positioned at the first byte. Otherwise, if the target file exists:- If the mode is
CREATE_NEW, an error is raised. - If the mode is
OVERWRITE, the existing file is replaced with the byte written to the resulting stream. - If the mode is
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.
- Specified by:
newOutputStreamin interfaceFileSystem- Parameters:
path- the file to writemode- how to handle writes to existing files- Returns:
- a stream for writing (or appending) the contents of the file
- Throws:
IOException- if I/O errors occur or if the target is a directory
- If the mode is
-
newFileChannel
Description copied from interface:FileSystemOpens the specified file for random access. Not all schemes support random access; consult specific implementations for details.- Specified by:
newFileChannelin interfaceFileSystem- Parameters:
path- the file or directory to read- Returns:
- a stream for reading the contents of the path
- Throws:
IOException- if I/O errors occurFileNotFoundException- if the specified path does not exist
-
exists
Description copied from interface:FileSystemIndicates whether the specified path represents an existing file or directory.- Specified by:
existsin interfaceFileSystem- Parameters:
path- the path to test- Returns:
truethe path exists,falseotherwise.- Throws:
IOException- if I/O errors occur
-
getDetails
Description copied from interface:FileSystemReturns metadata associated with the specified path.- Specified by:
getDetailsin interfaceFileSystem- Parameters:
path- the path for which to get metadata- Returns:
- metadata for the specified file system object, if it exists.
nullif it does not exist. - Throws:
IOException- if I/O errors occur
-
getLength
Description copied from interface:FileSystemReturns the length of the file represented by the given path.- Specified by:
getLengthin interfaceFileSystem- Parameters:
path- the path to test- Returns:
- the length of the file
- Throws:
IOException- if I/O errors occur
-
isDirectory
Description copied from interface:FileSystemIndicates whether the specified path represents a directory.- Specified by:
isDirectoryin interfaceFileSystem- Parameters:
path- the path to test- Returns:
truethe path represents a directory,- Throws:
IOException
-
isFile
Description copied from interface:FileSystemIndicates whether the specified path represents a file.- Specified by:
isFilein interfaceFileSystem- Parameters:
path- the path to test- Returns:
truethe path represents a file,- Throws:
IOException
-
isReadable
Description copied from interface:FileSystemIndicates whether the specified path can be read.- Specified by:
isReadablein interfaceFileSystem- Parameters:
path- the path to test- Returns:
truethe path represents a readable file or directory,falseotherwise.- Throws:
IOException- if I/O errors occur
-
isWritable
Description copied from interface:FileSystemIndicates whether the specified path can be written.- Specified by:
isWritablein interfaceFileSystem- Parameters:
path- the path to test- Returns:
truethe path represents a readable file or directory,falseotherwise.- Throws:
IOException- if I/O errors occur
-
isCreatable
Description copied from interface:FileSystemIndicates whether the specified path can be created.- Specified by:
isCreatablein interfaceFileSystem- Parameters:
path- the path to test- Returns:
truethe path represents a nonexistent file or directory which could be created,falseotherwise.- Throws:
IOException- if I/O errors occur
-
isHidden
Description copied from interface:FileSystemIndicates whether the associated path is hidden by the file system.- Specified by:
isHiddenin interfaceFileSystem- Parameters:
path- the path to test- Returns:
trueif the path is hidden,falseotherwise.- Throws:
IOException- if I/O errors occur
-
listDirectory
Description copied from interface:FileSystemGets the contents of the specified directory, applying a filter.- Specified by:
listDirectoryin interfaceFileSystem- Parameters:
path- the directory for which to get a filtered content listfilter- a filter to apply to the contents- Returns:
- all children of the directory which pass the filter
- Throws:
IOException- if I/O errors occur or if the path identifies a file
-
getSplits
Description copied from interface:FileSystemComputes data splits over the specified file. The supplied options are used to control the division of the file into splits, if the file system supports it.If a provider can provide locality information, it should, as this can be used to guide distributed execution.
- Specified by:
getSplitsin interfaceFileSystem- Parameters:
path- the file for which to get splitsoptions- configuration for the process of dividing the file- Returns:
- an iterator generating the data splits over the target
- Throws:
IOException- if an I/O error occurs
-
supportsConcat
public boolean supportsConcat()Description copied from interface:FileSystemReturns whether this filesystem supports theconcatmethod.- Specified by:
supportsConcatin interfaceFileSystem- Returns:
- whether this filesystem supports the concat method
-
concat
Description copied from interface:FileSystemReturns an input stream consisting of the given list of paths concatenated together. Most filesystem implementations should not need to implement this method. This is an optimization for remote filesystems to perform a bulk-fetch.- Specified by:
concatin interfaceFileSystem- Parameters:
paths- the list of pathsignoreNonExistent- whether to skip non-existent files- Returns:
- a concatenated input stream
- Throws:
IOException
-
getImplementation
- Specified by:
getImplementationin interfaceFileSystem
-