public class HostsUtil extends Object
| 构造器和说明 |
|---|
HostsUtil() |
| 限定符和类型 | 方法和说明 |
|---|---|
static boolean |
append(String ip,
String domain)
添加 hosts
|
static boolean |
delete(String ip,
String domain)
根据输入IP和Domain,删除host文件中的某个host配置
|
static boolean |
exists(String ip,
String domain)
判断 dns是否存在
|
static boolean |
flushdns() |
static String |
getHostFile()
获取host文件路径
|
static Set<String> |
read()
读取hosts文件
|
public static String getHostFile()
public static Set<String> read() throws IOException
IOException - IOExceptionpublic static boolean append(String ip, String domain) throws IOException
IOException - IOExceptionpublic static boolean exists(String ip, String domain) throws IOException
IOException - IOExceptionpublic static boolean flushdns()
public static boolean delete(String ip, String domain) throws IOException
IOExceptionCopyright © 2023 tan. All rights reserved.