### Function

# Dex file_replace_contents

unstable since: 1.2

#### Declaration [src]

    DexFuture*
    dex_file_replace_contents (
      GFile* file,
      const char* contents,
      gsize length,
      const char* etag,
      gboolean make_backup,
      GFileCreateFlags flags
    )

#### Description [src]

Wraps `g_file_replace_contents_async()`.

This function copies `contents` into a `GBytes` so the caller does not need to keep the buffer alive for the duration of the operation.

Available since: 1.2

#### Parameters

`file`

  Type: `GFile`

  A `GFile`.

  The data is owned by the caller of the function.

`contents`

  Type: An array of `guint8`

  The contents to write.

  The length of the array is specified in the `length` argument.
  The data is owned by the caller of the function.

`length`

  Type: `gsize`

  The length of `contents`.

`etag`

  Type: `const char*`

  The etag or `NULL`.

  The argument can be `NULL`.
  The data is owned by the caller of the function.
  The value is a NUL terminated UTF-8 string.

`make_backup`

  Type: `gboolean`

  If a backup file should be created.

`flags`

  Type: `GFileCreateFlags`

  A set of `GFileCreateFlags`.

#### Return value

Type: `DexFuture`

A `DexFuture` which resolves to the new etag, or `NULL` if no etag is available.

The caller of the function takes ownership of the data, and is responsible for freeing it.