小编Rob*_*rdo的帖子

Java临时文件,读写

我有这段代码

package Classes;

import java.io.*;

public class IpAdministrator {

    public Boolean isActive(String ipAddress) {
        boolean isActive = false;
        String cmd;
        String OS = System.getProperty("os.name");
        System.out.println(OS);
        String tmpfolder = System.getProperty("java.io.tmpdir");
        System.out.println(tmpfolder);

        //iptmp.deleteOnExit();

        if (OS.equals("Linux")) {
            cmd = "ping " + ipAddress + " -c 1";
        } else {
            cmd = "cmd /c ping " + ipAddress + " -n 1";
        }
        try {
            String s = null;
            Process p = Runtime.getRuntime().exec(cmd);
            File iptmp = File.createTempFile("ipresult", ".txt", new File(tmpfolder));


            BufferedReader stdInput = …
Run Code Online (Sandbox Code Playgroud)

java file temp

1
推荐指数
1
解决办法
7958
查看次数

标签 统计

file ×1

java ×1

temp ×1