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

io.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 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;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy