io.github.eliux.mega.cmd.AbstractMegaCmd Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of megacmd4j Show documentation
Show all versions of megacmd4j Show documentation
Java client library that works on top of MEGAcmd to provide access to the services of Mega.nz
package io.github.eliux.mega.cmd;
import io.github.eliux.mega.MegaUtils;
import io.github.eliux.mega.platform.OSPlatform;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
public abstract class AbstractMegaCmd {
protected List executableCommand() {
final String[] cmdInstructions = MegaUtils.convertInstructionsToExecParams(
getCmdAdaptedToPlatform()
);
return Arrays.asList(cmdInstructions);
}
protected String[] executableCommandArray(){
final List execCmd = executableCommand();
String[] execCmdArray = new String[execCmd.size()];
execCmd.toArray(execCmdArray);
return execCmdArray;
}
protected String getCmdAdaptedToPlatform() {
return OSPlatform.getCurrent().cmdInstruction(getCmd());
}
public abstract String getCmd();
}