Package io.trino.filesystem
Interface TrinoOutputFile
- All Known Implementing Classes:
LocalOutputFile
public interface TrinoOutputFile
-
Method Summary
Modifier and TypeMethodDescriptiondefault OutputStreamcreate()This method delegates tocreate(AggregatedMemoryContext).create(AggregatedMemoryContext memoryContext) Open an output stream for creating a new file.default voidcreateExclusive(byte[] data) Create file exclusively and atomically with the specified content.voidcreateOrOverwrite(byte[] data) Create file with the specified content, atomically if possible.location()
-
Method Details
-
create
This method delegates tocreate(AggregatedMemoryContext).- Throws:
IOException
-
createOrOverwrite
Create file with the specified content, atomically if possible. The file will be replaced if it already exists. If an error occurs while writing and the implementation does not support atomic writes, then a partial file may be written, or the original file may be deleted or left unchanged.- Throws:
IOException
-
createExclusive
Create file exclusively and atomically with the specified content. If an error occurs while writing, the file will not be created.- Throws:
FileAlreadyExistsException- if the file already existsUnsupportedOperationException- if the file system does not support this operationIOException
-
create
Open an output stream for creating a new file. This method is expected to be used with unique locations.If the file already exists, the method may fail or the file may be overwritten, depending on the file system implementation. For example, S3 does not support creating files exclusively, and performing an existence check before creating the file is both expensive and unnecessary for locations that are expected to be unique.
The file may be created immediately, or it may be created atomically when the output stream is closed, depending on the file system implementation.
- Throws:
FileAlreadyExistsException- if the file already exists (optional)IOException
-
location
Location location()
-