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

io.github.eliux.mega.MegaServer Maven / Gradle / Ivy

Go to download

Java client library that works on top of MEGAcmd to provide access to the services of Mega.nz

There is a newer version: 1.6.2
Show newest version
package io.github.eliux.mega;

import io.github.eliux.mega.error.MegaUnexpectedFailureException;
import io.github.eliux.mega.platform.OSPlatform;

public class MegaServer {

    private static MegaServer current;

    public static MegaServer getCurrent() {
        if (current == null) {
            current = new MegaServer();
        }

        return current;
    }

    private MegaServer() {
    }

    public void start() {
        try {
            final String[] cmdParams = MegaUtils.convertInstructionsToExecParams(
                OSPlatform.getCurrent().cmdInstruction("help")
            );
            MegaUtils.execCmd(cmdParams);
        } catch (Exception e) {
            throw new MegaUnexpectedFailureException();
        }
    }

    public void stop() {
        Mega.quit();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy