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

com.rationaleemotions.FileStatOutput Maven / Gradle / Ivy

Go to download

A simple way of interacting with a remote host for executing commands, scp (upload and download)

There is a newer version: 1.0.2
Show newest version
package com.rationaleemotions;

/**
 *
 */
enum FileStatOutput {
    FILE,
    DIRECTORY,
    DOESNOT_EXIST,
    UNKNOWN;

    static FileStatOutput parse(String text) {
        if (text == null || text.trim().isEmpty()) {
            return UNKNOWN;
        }
        if ("regular file".equalsIgnoreCase(text.trim())) {
            return FILE;
        }
        if ("directory".equalsIgnoreCase(text.trim())) {
            return DIRECTORY;
        }
        if (text.trim().toLowerCase().contains("no such file or directory")) {
            return DOESNOT_EXIST;
        }
        return UNKNOWN;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy