Class S3OutputFile

java.lang.Object
org.apache.iceberg.aws.s3.S3OutputFile
All Implemented Interfaces:
NativelyEncryptedFile, OutputFile

public class S3OutputFile extends Object implements OutputFile, NativelyEncryptedFile
  • Method Details

    • fromLocation

      @Deprecated public static S3OutputFile fromLocation(String location, software.amazon.awssdk.services.s3.S3Client client, S3FileIOProperties s3FileIOProperties, MetricsContext metrics)
      Deprecated.
      since 1.10.0, will be removed in 1.11.0; use fromLocation(String, PrefixedS3Client, MetricsContext) instead.
      Creates a S3OutputFile from the given parameters.
    • fromLocation

      @Deprecated public static S3OutputFile fromLocation(String location, software.amazon.awssdk.services.s3.S3Client client, software.amazon.awssdk.services.s3.S3AsyncClient asyncClient, S3FileIOProperties s3FileIOProperties, MetricsContext metrics)
      Deprecated.
      since 1.10.0, will be removed in 1.11.0; use fromLocation(String, PrefixedS3Client, MetricsContext) instead.
      Creates a S3OutputFile from the given parameters.
    • create

      public PositionOutputStream create()
      Create an output stream for the specified location if the target object does not exist in S3 at the time of invocation.
      Specified by:
      create in interface OutputFile
      Returns:
      output stream
    • createOrOverwrite

      public PositionOutputStream createOrOverwrite()
      Description copied from interface: OutputFile
      Create a new file and return a PositionOutputStream to it.

      If the file already exists, this will not throw an exception and will replace the file.

      Specified by:
      createOrOverwrite in interface OutputFile
      Returns:
      an output stream that can report its position
    • toInputFile

      public InputFile toInputFile()
      Description copied from interface: OutputFile
      Return an InputFile for the location of this output file.
      Specified by:
      toInputFile in interface OutputFile
      Returns:
      an input file for the location of this output file
    • nativeCryptoParameters

      public NativeFileCryptoParameters nativeCryptoParameters()
      Specified by:
      nativeCryptoParameters in interface NativelyEncryptedFile
    • setNativeCryptoParameters

      public void setNativeCryptoParameters(NativeFileCryptoParameters nativeCryptoParameters)
      Specified by:
      setNativeCryptoParameters in interface NativelyEncryptedFile
    • location

      public String location()
    • s3FileIOProperties

      public S3FileIOProperties s3FileIOProperties()
    • metrics

      protected MetricsContext metrics()
    • exists

      public boolean exists()
      Note: this may be stale if file was deleted since metadata is cached for size/existence checks.
      Returns:
      flag
    • getObjectMetadata

      protected software.amazon.awssdk.services.s3.model.HeadObjectResponse getObjectMetadata() throws software.amazon.awssdk.services.s3.model.S3Exception
      Throws:
      software.amazon.awssdk.services.s3.model.S3Exception
    • toString

      public String toString()
      Overrides:
      toString in class Object