Package org.apache.iceberg.aws.s3
Class S3OutputFile
- java.lang.Object
-
- org.apache.iceberg.aws.s3.S3OutputFile
-
- All Implemented Interfaces:
NativelyEncryptedFile,OutputFile
public class S3OutputFile extends java.lang.Object implements OutputFile, NativelyEncryptedFile
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description PositionOutputStreamcreate()Create an output stream for the specified location if the target object does not exist in S3 at the time of invocation.PositionOutputStreamcreateOrOverwrite()Create a new file and return aPositionOutputStreamto it.booleanexists()Note: this may be stale if file was deleted since metadata is cached for size/existence checks.static S3OutputFilefromLocation(java.lang.String location, software.amazon.awssdk.services.s3.S3Client client, S3FileIOProperties s3FileIOProperties, MetricsContext metrics)protected software.amazon.awssdk.services.s3.model.HeadObjectResponsegetObjectMetadata()java.lang.Stringlocation()protected MetricsContextmetrics()NativeFileCryptoParametersnativeCryptoParameters()S3FileIOPropertiess3FileIOProperties()voidsetNativeCryptoParameters(NativeFileCryptoParameters nativeCryptoParameters)InputFiletoInputFile()Return anInputFilefor the location of this output file.java.lang.StringtoString()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.iceberg.io.OutputFile
location
-
-
-
-
Method Detail
-
fromLocation
public static S3OutputFile fromLocation(java.lang.String location, software.amazon.awssdk.services.s3.S3Client client, S3FileIOProperties s3FileIOProperties, MetricsContext metrics)
-
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:
createin interfaceOutputFile- Returns:
- output stream
-
createOrOverwrite
public PositionOutputStream createOrOverwrite()
Description copied from interface:OutputFileCreate a new file and return aPositionOutputStreamto it.If the file already exists, this will not throw an exception and will replace the file.
- Specified by:
createOrOverwritein interfaceOutputFile- Returns:
- an output stream that can report its position
-
toInputFile
public InputFile toInputFile()
Description copied from interface:OutputFileReturn anInputFilefor the location of this output file.- Specified by:
toInputFilein interfaceOutputFile- Returns:
- an input file for the location of this output file
-
nativeCryptoParameters
public NativeFileCryptoParameters nativeCryptoParameters()
- Specified by:
nativeCryptoParametersin interfaceNativelyEncryptedFile
-
setNativeCryptoParameters
public void setNativeCryptoParameters(NativeFileCryptoParameters nativeCryptoParameters)
- Specified by:
setNativeCryptoParametersin interfaceNativelyEncryptedFile
-
location
public java.lang.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 java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-