public class ResolvingFileIO extends java.lang.Object implements HadoopConfigurable, DelegateFileIO
DelegateFileIO
mixin interface,
otherwise initialization will fail.Constructor and Description |
---|
ResolvingFileIO()
No-arg constructor to load the FileIO dynamically.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Close File IO to release underlying resources.
|
void |
deleteFile(java.lang.String location)
Delete the file at the given path.
|
void |
deleteFiles(java.lang.Iterable<java.lang.String> pathsToDelete)
Delete the files at the given paths.
|
void |
deletePrefix(java.lang.String prefix)
Delete all files under a prefix.
|
protected void |
finalize() |
org.apache.hadoop.conf.Configuration |
getConf() |
void |
initialize(java.util.Map<java.lang.String,java.lang.String> newProperties)
Initialize File IO from catalog properties.
|
java.lang.Class<?> |
ioClass(java.lang.String location) |
java.lang.Iterable<FileInfo> |
listPrefix(java.lang.String prefix)
Return an iterable of all files under a prefix.
|
InputFile |
newInputFile(java.lang.String location)
Get a
InputFile instance to read bytes from the file at the given path. |
InputFile |
newInputFile(java.lang.String location,
long length)
Get a
InputFile instance to read bytes from the file at the given path, with a known
file length. |
OutputFile |
newOutputFile(java.lang.String location)
Get a
OutputFile instance to write bytes to the file at the given path. |
java.util.Map<java.lang.String,java.lang.String> |
properties()
Returns the property map used to configure this FileIO
|
void |
serializeConfWith(java.util.function.Function<org.apache.hadoop.conf.Configuration,SerializableSupplier<org.apache.hadoop.conf.Configuration>> confSerializer)
Take a function that serializes Hadoop configuration into a supplier.
|
void |
setConf(org.apache.hadoop.conf.Configuration conf) |
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
deleteFile, deleteFile, newInputFile, newInputFile, newInputFile
public ResolvingFileIO()
All fields are initialized by calling initialize(Map)
later.
public InputFile newInputFile(java.lang.String location)
FileIO
InputFile
instance to read bytes from the file at the given path.newInputFile
in interface FileIO
public InputFile newInputFile(java.lang.String location, long length)
FileIO
InputFile
instance to read bytes from the file at the given path, with a known
file length.newInputFile
in interface FileIO
public OutputFile newOutputFile(java.lang.String location)
FileIO
OutputFile
instance to write bytes to the file at the given path.newOutputFile
in interface FileIO
public void deleteFile(java.lang.String location)
FileIO
deleteFile
in interface FileIO
public void deleteFiles(java.lang.Iterable<java.lang.String> pathsToDelete) throws BulkDeletionFailureException
SupportsBulkOperations
deleteFiles
in interface SupportsBulkOperations
pathsToDelete
- The paths to deleteBulkDeletionFailureException
- in case of failure to delete at least 1 filepublic java.util.Map<java.lang.String,java.lang.String> properties()
FileIO
properties
in interface FileIO
public void initialize(java.util.Map<java.lang.String,java.lang.String> newProperties)
FileIO
initialize
in interface FileIO
newProperties
- catalog propertiespublic void close()
FileIO
Calling this method is only required when this FileIO instance is no longer expected to be used, and the resources it holds need to be explicitly released to avoid resource leaks.
public void serializeConfWith(java.util.function.Function<org.apache.hadoop.conf.Configuration,SerializableSupplier<org.apache.hadoop.conf.Configuration>> confSerializer)
HadoopConfigurable
serializeConfWith
in interface HadoopConfigurable
confSerializer
- A function that takes Hadoop configuration and returns a serializable
supplier of it.public void setConf(org.apache.hadoop.conf.Configuration conf)
setConf
in interface org.apache.hadoop.conf.Configurable
public org.apache.hadoop.conf.Configuration getConf()
getConf
in interface org.apache.hadoop.conf.Configurable
public java.lang.Class<?> ioClass(java.lang.String location)
protected void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable
public java.lang.Iterable<FileInfo> listPrefix(java.lang.String prefix)
SupportsPrefixOperations
Hierarchical file systems (e.g. HDFS) may impose additional restrictions like the prefix must fully match a directory whereas key/value object stores may allow for arbitrary prefixes.
listPrefix
in interface SupportsPrefixOperations
prefix
- prefix to listpublic void deletePrefix(java.lang.String prefix)
SupportsPrefixOperations
Hierarchical file systems (e.g. HDFS) may impose additional restrictions like the prefix must fully match a directory whereas key/value object stores may allow for arbitrary prefixes.
deletePrefix
in interface SupportsPrefixOperations
prefix
- prefix to delete