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

org.libtorrent4j.ErrorCode Maven / Gradle / Ivy

There is a newer version: 2.1.0-35
Show newest version
/*
 * Copyright (c) 2018-2020, Alden Torres
 *
 * Licensed under the terms of the MIT license.
 * Copy of the license at https://opensource.org/licenses/MIT
 */

package org.libtorrent4j;

import org.libtorrent4j.swig.error_code;

/**
 * @author gubatron
 * @author aldenml
 */
public final class ErrorCode {

    private int value;
    private String message;
    private boolean isError;

    /**
     * @param ec the native object
     */
    public ErrorCode(error_code ec) {
        assign(ec);
    }

    /**
     * @return the internal error code value
     */
    public int getValue() {
        return value;
    }

    /**
     * @return the error message
     */
    public String getMessage() {
        return message;
    }

    /**
     * Returns if this error code actually represents an error.
     *
     * @return true if an actual error
     */
    public boolean isError() {
        return isError;
    }

    void assign(error_code ec) {
        value = ec.value();
        message = ec.message();
        isError = ec.to_bool();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy