Class WriteOptions
All supplied conditions must hold for the write to commit. Unsupported conditions, append, or expires fail with OpenDALException.Code.Unsupported. Unsupported metadata options may be ignored. Failed conditions fail with OpenDALException.Code.ConditionNotMatch. Invalid expires or ifNotChanged values fail with OpenDALException.Code.ConfigInvalid. Presigned write requests validate options and capabilities without executing against storage.
Optional reference fields default to null.
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal booleanSets append mode for this operation.final StringSets Cache-Control header for this write operation.final longSets chunk size for buffered writes.final intSets concurrent write operations for this writer.final StringSets Content-Disposition header for this write request.final StringSets Content-Encoding header for this write request.final StringSets Content-Language system metadata on the object being written.final StringSetsContent-Typeheader for this write operation.final DurationSets how long the new file lives after the write commits.final StringWrite only when the file at the write path has this exact ETag.final StringWrite only when the file at the write path does not have this ETag.final MetadataWrite only when the file at the write path still has the identity recorded in this metadata.final booleanWrite only when no file exists at the write path.final StringWrite only when the file at the write path has this exact version.final StringWrite only when the file at the write path does not have this version.Sets user metadata for this write request. -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
contentType
-
contentDisposition
Sets Content-Disposition header for this write request.- See Also:
-
cacheControl
-
contentEncoding
-
ifMatch
Write only when the file at the write path has this exact ETag.The condition succeeds when the file exists and its ETag equals this value. A file with a different ETag, or a missing file, fails the write with
OpenDALException.Code.ConditionNotMatch. Only concrete ETag values are portable; a wildcard such as"*"has no portable meaning here.- See Also:
-
ifNoneMatch
Write only when the file at the write path does not have this ETag.With a concrete ETag value, the condition succeeds when the file has a different ETag or does not exist; the write then replaces or creates the file. A file whose ETag equals this value fails the write with
OpenDALException.Code.ConditionNotMatch. Only concrete ETag values are portable; a wildcard such as"*"has no portable meaning here.- See Also:
-
userMetadata
-
append
public final boolean appendSets append mode for this operation.- See Also:
-
ifNotExists
public final boolean ifNotExistsWrite only when no file exists at the write path.The condition succeeds when the path is empty, so the write creates the file. An existing file fails the write with
OpenDALException.Code.ConditionNotMatch.- See Also:
-
concurrent
public final int concurrentSets concurrent write operations for this writer.Defaults to
1. Values less than or equal to0, or too large for the native platform's unsigned pointer-sized integer, fail withOpenDALException.Code.Unexpected.- See Also:
-
chunk
public final long chunkSets chunk size for buffered writes.The default of
-1Luses the service's default chunk size. Positive values set the chunk size in bytes and must fit the native platform's unsigned pointer-sized integer.0L, other negative values, and values that do not fit fail withOpenDALException.Code.Unexpected.- See Also:
-
contentLanguage
Sets Content-Language system metadata on the object being written.Use a language tag or a comma-separated list of tags, such as
fr-CA, en. CheckCapability.writeWithContentLanguagefor support. A subsequent stat can retrieve the stored value withMetadata.contentLanguage. Services without support may ignore this option.- See Also:
-
expires
Sets how long the new file lives after the write commits.A supplied duration overrides the service's default TTL. When unset, the service uses its usual expiration policy. Services round positive durations up to their supported precision.
Supply a positive
Duration. Zero, negative, or unrepresentable durations fail withOpenDALException.Code.ConfigInvalid. The write fails withOpenDALException.Code.Unsupportedwhen the service does not advertiseCapability.writeWithExpires.- See Also:
-
ifVersionMatch
Write only when the file at the write path has this exact version.The condition succeeds when the file exists and its version equals this value. A file with a different version, or a missing file, fails the write with
OpenDALException.Code.ConditionNotMatch.- See Also:
-
ifVersionNotMatch
Write only when the file at the write path does not have this version.The condition succeeds when the file exists with a different version. A file whose version equals this value fails the write with
OpenDALException.Code.ConditionNotMatch. When no file exists at the write path, no portable behavior is defined.- See Also:
-
ifNotChanged
Write only when the file at the write path still has the identity recorded in this metadata.Pass metadata previously returned by OpenDAL for the same path. OpenDAL derives a version match when the service supports version conditions and the metadata contains a version. Otherwise it uses a non-weak ETag if present. A changed or missing file fails the write with
OpenDALException.Code.ConditionNotMatch, as does combining this option with a conflictingifMatchorifVersionMatchvalue.The operation returns
OpenDALException.Code.Unsupportedwhen the service does not support the derived primitive condition, andOpenDALException.Code.ConfigInvalidwhen the metadata contains neither a version nor a non-weak ETag.
-
-
Constructor Details
-
WriteOptions
public WriteOptions()
-