Class LocalOutputFile

java.lang.Object
io.trino.filesystem.local.LocalOutputFile
All Implemented Interfaces:
TrinoOutputFile

public class LocalOutputFile extends Object implements TrinoOutputFile
  • Constructor Details

    • LocalOutputFile

      public LocalOutputFile(Location location, Path path)
    • LocalOutputFile

      public LocalOutputFile(File file)
  • Method Details

    • create

      public OutputStream create(AggregatedMemoryContext memoryContext) throws IOException
      Description copied from interface: TrinoOutputFile
      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.

      Specified by:
      create in interface TrinoOutputFile
      Throws:
      IOException
    • createOrOverwrite

      public void createOrOverwrite(byte[] data) throws IOException
      Description copied from interface: TrinoOutputFile
      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.
      Specified by:
      createOrOverwrite in interface TrinoOutputFile
      Throws:
      IOException
    • location

      public Location location()
      Specified by:
      location in interface TrinoOutputFile
    • toString

      public String toString()
      Overrides:
      toString in class Object