public interface FileIO
extends java.io.Serializable, java.io.Closeable
Both table metadata files and data files can be written and read by this module. Implementations must be serializable because various clients of Spark tables may initialize this once and pass it off to a separate module that would then interact with the streams.
Modifier and Type | Method and Description |
---|---|
default void |
close()
Close File IO to release underlying resources.
|
default void |
deleteFile(InputFile file)
|
default void |
deleteFile(OutputFile file)
Convenience method to
delete an OutputFile . |
void |
deleteFile(java.lang.String path)
Delete the file at the given path.
|
default void |
initialize(java.util.Map<java.lang.String,java.lang.String> properties)
Initialize File IO from catalog properties.
|
InputFile |
newInputFile(java.lang.String path)
Get a
InputFile instance to read bytes from the file at the given path. |
default InputFile |
newInputFile(java.lang.String path,
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 path)
Get a
OutputFile instance to write bytes to the file at the given path. |
default java.util.Map<java.lang.String,java.lang.String> |
properties()
Returns the property map used to configure this FileIO
|
InputFile newInputFile(java.lang.String path)
InputFile
instance to read bytes from the file at the given path.default InputFile newInputFile(java.lang.String path, long length)
InputFile
instance to read bytes from the file at the given path, with a known
file length.OutputFile newOutputFile(java.lang.String path)
OutputFile
instance to write bytes to the file at the given path.void deleteFile(java.lang.String path)
default void deleteFile(InputFile file)
default void deleteFile(OutputFile file)
delete
an OutputFile
.default java.util.Map<java.lang.String,java.lang.String> properties()
java.lang.UnsupportedOperationException
- if this FileIO does not expose its configuration
propertiesdefault void initialize(java.util.Map<java.lang.String,java.lang.String> properties)
properties
- catalog propertiesdefault void close()
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.
close
in interface java.lang.AutoCloseable
close
in interface java.io.Closeable