io.github.eliux.mega.cmd.MegaCmdPutSingle 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 java.util.LinkedList;
import java.util.List;
import java.util.Optional;
public class MegaCmdPutSingle extends AbstractMegaCmdPut {
private final String localFile;
private Optional remotePath;
public MegaCmdPutSingle(String localFile) {
this.localFile = localFile;
this.remotePath = Optional.empty();
}
public MegaCmdPutSingle(String localFile, String remotePath) {
this.localFile = localFile;
this.remotePath = Optional.of(remotePath);
}
protected List cmdFileParams() {
final List cmdFileParams = new LinkedList<>();
cmdFileParams.add(getLocalFile());
getRemotePath().ifPresent(cmdFileParams::add);
return cmdFileParams;
}
public String getLocalFile() {
return localFile;
}
public Optional getRemotePath() {
return remotePath;
}
public MegaCmdPutSingle setRemotePath(String remotePath) {
this.remotePath = Optional.of(remotePath);
return this;
}
}