GLib.MappedFile
Description: Reference for GLib.MappedFile

### Struct

# GLibMappedFile

#### Description [src]

    struct GMappedFile {
      /* No available fields */
    }

The `GMappedFile` represents a file mapping created with g_mapped_file_new(). It has only private members and should not be accessed directly.

#### Constructors

###### g_mapped_file_new

Maps a file into memory. On UNIX, this is using the `mmap()` function.

since: 2.8

###### g_mapped_file_new_from_fd

Maps a file into memory. On UNIX, this is using the `mmap()` function.

since: 2.32

#### Instance methods

###### g_mapped_file_free

This call existed before `GMappedFile` had refcounting and is currently exactly the same as g_mapped_file_unref().

deprecated: 2.22 since: 2.8

###### g_mapped_file_get_bytes

Creates a new `GBytes` which references the data mapped from `file`. The mapped contents of the file must not be modified after creating this bytes object, because a `GBytes` should be immutable.

since: 2.34

###### g_mapped_file_get_contents

Returns the contents of a `GMappedFile`.

since: 2.8

###### g_mapped_file_get_length

Returns the length of the contents of a `GMappedFile`.

since: 2.8

###### g_mapped_file_ref

Increments the reference count of `file` by one. It is safe to call this function from any thread.

since: 2.22

###### g_mapped_file_unref

Decrements the reference count of `file` by one. If the reference count drops to 0, unmaps the buffer of `file` and frees it.