All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.gnome.glib.FileSetContentsFlags Maven / Gradle / Ivy

// Java-GI - Java language bindings for GObject-Introspection-based libraries
// Copyright (C) 2022-2024 Jan-Willem Harmannij
//
// SPDX-License-Identifier: LGPL-2.1-or-later
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, see .
//
// This file has been generated with Java-GI.
// Do not edit this file directly!
// Visit  for more information.
//
package org.gnome.glib;

import io.github.jwharm.javagi.base.Bitfield;
import javax.annotation.processing.Generated;

/**
 * Flags to pass to g_file_set_contents_full() to affect its safety and
 * performance.
 * @version 2.66
 */
@Generated("io.github.jwharm.JavaGI")
public class FileSetContentsFlags extends Bitfield {
    /**
     * No guarantees about file consistency or durability.
     *   The most dangerous setting, which is slightly faster than other settings.
     */
    public static final FileSetContentsFlags NONE = new FileSetContentsFlags(0);

    /**
     * Guarantee file consistency: after a crash,
     *   either the old version of the file or the new version of the file will be
     *   available, but not a mixture. On Unix systems this equates to an {@code fsync()}
     *   on the file and use of an atomic {@code rename()} of the new version of the file
     *   over the old.
     */
    public static final FileSetContentsFlags CONSISTENT = new FileSetContentsFlags(1);

    /**
     * Guarantee file durability: after a crash, the
     *   new version of the file will be available. On Unix systems this equates to
     *   an {@code fsync()} on the file (if {@link org.gnome.glib.FileSetContentsFlags#CONSISTENT} is unset), or
     *   the effects of {@link org.gnome.glib.FileSetContentsFlags#CONSISTENT} plus an {@code fsync()} on the
     *   directory containing the file after calling {@code rename()}.
     */
    public static final FileSetContentsFlags DURABLE = new FileSetContentsFlags(2);

    /**
     * Only apply consistency and durability
     *   guarantees if the file already exists. This may speed up file operations
     *   if the file doesn’t currently exist, but may result in a corrupted version
     *   of the new file if the system crashes while writing it.
     */
    public static final FileSetContentsFlags ONLY_EXISTING = new FileSetContentsFlags(4);

    static {
        GLib.javagi$ensureInitialized();
    }

    /**
     * Create a new FileSetContentsFlags with the provided value
     */
    public FileSetContentsFlags(int value) {
        super(value);
    }

    /**
     * Combine (bitwise OR) operation
     *
     * @param masks one or more values to combine with
     * @return the combined value by calculating {@code this | mask}
     */
    public FileSetContentsFlags or(FileSetContentsFlags... masks) {
        int value = this.getValue();
        for (FileSetContentsFlags arg : masks) {
            value |= arg.getValue();
        }
        return new FileSetContentsFlags(value);
    }

    /**
     * Combine (bitwise OR) operation
     *
     * @param mask the first value to combine
     * @param masks the other values to combine
     * @return the combined value by calculating {@code mask | masks[0] | masks[1] | ...}
     */
    public static FileSetContentsFlags combined(FileSetContentsFlags mask,
            FileSetContentsFlags... masks) {
        int value = mask.getValue();
        for (FileSetContentsFlags arg : masks) {
            value |= arg.getValue();
        }
        return new FileSetContentsFlags(value);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy