Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/

API Reference

Class

OfficeImageFileWriter

Namespace OfficeIMO.Drawing
Assembly OfficeIMO.Core
Modifiers static

Saves already encoded image bytes through a same-directory atomic file commit.

Inheritance

  • Object
  • OfficeImageFileWriter

Remarks

The supplied bytes are borrowed and are not modified, cloned, parsed, or format-validated. Keep them unchanged until the operation completes. An existing destination is overwritten only after staging succeeds. Unsupported atomic replacement fails without a non-atomic fallback. File-system failures propagate; failed staging is cleaned up when the file system permits it. Cancellation is observed while staging and immediately before commit. Once replacement begins, it can complete even if cancellation is requested. This API does not promise power-loss durability.

Methods

public static Void WriteAllBytes(String path, Byte[] encodedImage, CancellationToken cancellationToken = default) #
Returns: Void

Stages encoded bytes and atomically creates or replaces the destination file.

Parameters

path System.String requiredposition: 0
The destination file path. Missing parent directories are created.
encodedImage System.Byte[] requiredposition: 1
Already encoded bytes, borrowed until the method returns.
cancellationToken System.Threading.CancellationToken = default optionalposition: 2
Cancels staging and prevents publication when observed before commit.

Exceptions

  • ArgumentNullException – The supplied byte array is null.
public static Task WriteAllBytesAsync(String path, Byte[] encodedImage, CancellationToken cancellationToken = default) #
Returns: Task

Asynchronously stages encoded bytes and atomically creates or replaces the destination file.

Parameters

path System.String requiredposition: 0
The destination file path. Missing parent directories are created.
encodedImage System.Byte[] requiredposition: 1
Already encoded bytes, borrowed until the returned task completes.
cancellationToken System.Threading.CancellationToken = default optionalposition: 2
Cancels staging and prevents publication when observed before commit.

Exceptions

  • ArgumentNullException – The supplied byte array is null.