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

com.github.eliux.mega.cmd.MegaCmdPutSingle 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 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;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy