com.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 com.github.eliux.mega.cmd;
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 String cmdFileParams(){
StringBuilder cmdFileParamsBuilder =
new StringBuilder(getLocalFile());
getRemotePath().ifPresent(
x -> cmdFileParamsBuilder.append(" ".concat(x))
);
return cmdFileParamsBuilder.toString();
}
public String getLocalFile() {
return localFile;
}
public Optional getRemotePath() {
return remotePath;
}
public MegaCmdPutSingle setRemotePath(String remotePath) {
this.remotePath = Optional.of(remotePath);
return this;
}
}