| 限定符和类型 | 字段和说明 |
|---|---|
protected Map<Pair<String,String>,org.apache.hadoop.fs.FileSystem> |
fsMap |
protected SerializableConfiguration |
hadoopConf |
| 构造器和说明 |
|---|
HadoopFileIO() |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
configure(CatalogContext context)
Configure by
CatalogContext. |
protected org.apache.hadoop.fs.FileSystem |
createFileSystem(org.apache.hadoop.fs.Path path) |
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.
|
void |
overwriteFileUtf8(Path path,
String content)
Overwrite file by content atomically, different
FileIOs have different atomic
implementations. |
boolean |
rename(Path src,
Path dst)
Renames the file/directory src to dst.
|
void |
setFileSystem(Path path,
org.apache.hadoop.fs.FileSystem fs) |
boolean |
tryAtomicOverwriteViaRename(Path dst,
String content) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcheckOrMkdirs, copyFileUtf8, deleteDirectoryQuietly, deleteQuietly, discoverLoaders, get, getFileSize, isDir, readFileUtf8, readOverwrittenFileUtf8, writeFileUtf8protected SerializableConfiguration hadoopConf
@VisibleForTesting public void setFileSystem(Path path, org.apache.hadoop.fs.FileSystem fs) throws IOException
IOExceptionpublic boolean isObjectStore()
isObjectStore 在接口中 FileIOpublic void configure(CatalogContext context)
FileIOCatalogContext.public SeekableInputStream newInputStream(Path path) throws IOException
FileIOnewInputStream 在接口中 FileIOpath - the file to openIOExceptionpublic PositionOutputStream newOutputStream(Path path, boolean overwrite) throws IOException
FileIOnewOutputStream 在接口中 FileIOpath - 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
FileIOgetFileStatus 在接口中 FileIOpath - The path we want information fromFileNotFoundException - when the path does not exist; IOException see specific
implementationIOExceptionpublic FileStatus[] listStatus(Path path) throws IOException
FileIOlistStatus 在接口中 FileIOpath - given pathIOExceptionpublic boolean exists(Path path) throws IOException
FileIOexists 在接口中 FileIOpath - source fileIOExceptionpublic boolean delete(Path path, boolean recursive) throws IOException
FileIOdelete 在接口中 FileIOpath - 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 falsetrue if delete is successful, false otherwiseIOExceptionpublic boolean mkdirs(Path path) throws IOException
FileIOmkdirs 在接口中 FileIOpath - 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
FileIOrename 在接口中 FileIOsrc - the file/directory to renamedst - the new name of the file/directorytrue if the renaming was successful, false otherwiseIOExceptionpublic void overwriteFileUtf8(Path path, String content) throws IOException
FileIOFileIOs have different atomic
implementations.overwriteFileUtf8 在接口中 FileIOIOExceptionprotected org.apache.hadoop.fs.FileSystem createFileSystem(org.apache.hadoop.fs.Path path)
throws IOException
IOExceptionpublic boolean tryAtomicOverwriteViaRename(Path dst, String content) throws IOException
IOExceptionCopyright © 2023–2024 The Apache Software Foundation. All rights reserved.