Skip to content

Commit 7010c9c

Browse files
author
IPIP.net
committed
Update IP.java
1 parent 65cb55b commit 7010c9c

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

IP.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,20 @@ public static void load(String filename) {
5858
}
5959
}
6060

61+
public static void load(String filename, boolean strict) throws Exception {
62+
ipFile = new File(filename);
63+
if (strict) {
64+
int contentLength = Long.valueOf(ipFile.length()).intValue();
65+
if (contentLength < 512 * 1024) {
66+
throw new Exception("ip data file error.");
67+
}
68+
}
69+
load();
70+
if (enableFileWatch) {
71+
watch();
72+
}
73+
}
74+
6175
public static String[] find(String ip) {
6276
int ip_prefix_value = new Integer(ip.substring(0, ip.indexOf(".")));
6377
long ip2long_value = ip2long(ip);

0 commit comments

Comments
 (0)