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

com.hibegin.common.util.EnvKit Maven / Gradle / Ivy

Go to download

Simple, flexible, less dependent, more extended. Less memory footprint, can quickly build Web project. Can quickly run embedded, Android devices

There is a newer version: 0.3.162
Show newest version
package com.hibegin.common.util;

import java.io.File;

public class EnvKit {

    private static final boolean ANDROID;

    static {
        boolean tmpFlag;
        try {
            Class.forName("android.app.Application");
            tmpFlag = true;
        } catch (ClassNotFoundException e) {
            tmpFlag = false;
        }
        ANDROID = tmpFlag;
    }

    public static void savePid(String pidFile) {
        File file = new File(pidFile);
        if (file.exists()) {
            file.delete();
        }
        long pid = Pid.get();
        if (pid > 0) {
            IOUtil.writeStrToFile(pid + "", file);
            file.deleteOnExit();
        }
    }

    public static boolean isAndroid() {
        return ANDROID;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy