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

io.github.eliux.mega.cmd.AbstractMegaCmdRunner 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.cmd;


import io.github.eliux.mega.MegaUtils;
import io.github.eliux.mega.error.MegaIOException;

import java.io.IOException;


public abstract class AbstractMegaCmdRunner extends AbstractMegaCmd implements Runnable {

    @Override
    public void run() {
        executeSysCmd(executableCommandArray());
    }

    protected void executeSysCmd(String... cmdStr) {
        try {
          final int result = MegaUtils.execCmd(cmdStr);
          MegaUtils.handleResult(result);
        } catch (IOException e) {
            throw new MegaIOException();
        } catch (InterruptedException e) {
            throw new MegaIOException(
                    "The execution of %s couldn't be finished", getCmd()
            );
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy