public class RESTTokenFileIO extends Object implements FileIO
FileIO
to support getting token from REST Server.Modifier and Type | Field and Description |
---|---|
static ConfigOption<Boolean> |
DATA_TOKEN_ENABLED |
Constructor and Description |
---|
RESTTokenFileIO(RESTCatalogLoader catalogLoader,
RESTCatalog catalogInstance,
Identifier identifier,
Path path) |
Modifier and Type | Method and Description |
---|---|
void |
configure(CatalogContext context)
Configure by
CatalogContext . |
boolean |
delete(Path path,
boolean recursive)
Delete a file.
|
boolean |
exists(Path path)
Check if exists.
|
FileStatus |
getFileStatus(Path path)
Return a file status object that represents the path.
|
boolean |
isObjectStore() |
FileStatus[] |
listStatus(Path path)
List the statuses of the files/directories in the given path if the path is a directory.
|
boolean |
mkdirs(Path path)
Make the given file and all non-existent parents into directories.
|
SeekableInputStream |
newInputStream(Path path)
Opens an SeekableInputStream at the indicated Path.
|
PositionOutputStream |
newOutputStream(Path path,
boolean overwrite)
Opens an PositionOutputStream at the indicated Path.
|
boolean |
rename(Path src,
Path dst)
Renames the file/directory src to dst.
|
RESTToken |
validToken()
Public interface to get valid token, this can be invoked by native engines to get the token
and use own File System.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
checkOrMkdirs, close, copyFile, copyFiles, deleteDirectoryQuietly, deleteFilesQuietly, deleteQuietly, discoverLoaders, get, getFileSize, isDir, listDirectories, listFiles, listFilesIterative, overwriteFileUtf8, readFileUtf8, readOverwrittenFileUtf8, tryToWriteAtomic, writeFile
public static final ConfigOption<Boolean> DATA_TOKEN_ENABLED
public RESTTokenFileIO(RESTCatalogLoader catalogLoader, RESTCatalog catalogInstance, Identifier identifier, Path path)
public void configure(CatalogContext context)
FileIO
CatalogContext
.public SeekableInputStream newInputStream(Path path) throws IOException
FileIO
newInputStream
in interface FileIO
path
- the file to openIOException
public PositionOutputStream newOutputStream(Path path, boolean overwrite) throws IOException
FileIO
newOutputStream
in interface FileIO
path
- the file name to openoverwrite
- if a file with this name already exists, then if true, the file will be
overwritten, and if false an error will be thrown.IOException
- Thrown, if the stream could not be opened because of an I/O, or because a
file already exists at that path and the write mode indicates to not overwrite the file.public FileStatus getFileStatus(Path path) throws IOException
FileIO
getFileStatus
in interface FileIO
path
- The path we want information fromFileNotFoundException
- when the path does not exist; IOException see specific
implementationIOException
public FileStatus[] listStatus(Path path) throws IOException
FileIO
listStatus
in interface FileIO
path
- given pathIOException
public boolean exists(Path path) throws IOException
FileIO
exists
in interface FileIO
path
- source fileIOException
public boolean delete(Path path, boolean recursive) throws IOException
FileIO
delete
in interface FileIO
path
- the path to deleterecursive
- if path is a directory and set to true
, the directory is
deleted else throws an exception. In case of a file the recursive can be set to either
true
or false
true
if delete is successful, false
otherwiseIOException
public boolean mkdirs(Path path) throws IOException
FileIO
mkdirs
in interface FileIO
path
- the directory/directories to be createdtrue
if at least one new directory has been created, false
otherwiseIOException
- thrown if an I/O error occurs while creating the directorypublic boolean rename(Path src, Path dst) throws IOException
FileIO
rename
in interface FileIO
src
- the file/directory to renamedst
- the new name of the file/directorytrue
if the renaming was successful, false
otherwiseIOException
public boolean isObjectStore()
isObjectStore
in interface FileIO
public RESTToken validToken()
Copyright © 2023–2025 The Apache Software Foundation. All rights reserved.