public class IP2regionTemplate extends Object implements org.springframework.beans.factory.DisposableBean
| 限定符和类型 | 字段和说明 |
|---|---|
protected org.nutz.plugins.ip2region.DbSearcher |
dbSearcher |
protected org.slf4j.Logger |
log |
protected static String |
NOT_MATCH |
protected static RegionAddress |
NOT_MATCH_REGION_ADDRESS |
protected ReentrantReadWriteLock |
rwl |
| 构造器和说明 |
|---|
IP2regionTemplate(org.nutz.plugins.ip2region.DbSearcher dbSearcher) |
| 限定符和类型 | 方法和说明 |
|---|---|
org.nutz.plugins.ip2region.DataBlock |
binarySearch(long ip)
get the region with a int ip address with binary search algorithm
|
org.nutz.plugins.ip2region.DataBlock |
binarySearch(String ip)
get the region throught the ip address with binary search algorithm
|
org.nutz.plugins.ip2region.DataBlock |
btreeSearch(long ip)
get the region with a int ip address with b-tree algorithm
|
org.nutz.plugins.ip2region.DataBlock |
btreeSearch(String ip)
get the region throught the ip address with b-tree search algorithm
|
void |
destroy() |
org.nutz.plugins.ip2region.DataBlock |
getByIndexPtr(long ptr)
get by index ptr
|
String |
getCountryByIp(String ip) |
String |
getRegion(String ip) |
RegionAddress |
getRegionAddress(String ip) |
RegionEnum |
getRegionByIp(String ip) |
boolean |
isMainlandIp(String ip) |
org.nutz.plugins.ip2region.DataBlock |
memorySearch(long ip)
get the region with a int ip address with memory binary search algorithm
|
org.nutz.plugins.ip2region.DataBlock |
memorySearch(String ip)
get the region throught the ip address with memory binary search algorithm
|
protected org.slf4j.Logger log
protected org.nutz.plugins.ip2region.DbSearcher dbSearcher
protected ReentrantReadWriteLock rwl
protected static String NOT_MATCH
protected static RegionAddress NOT_MATCH_REGION_ADDRESS
public IP2regionTemplate(org.nutz.plugins.ip2region.DbSearcher dbSearcher)
throws IOException
IOExceptionpublic org.nutz.plugins.ip2region.DataBlock memorySearch(long ip)
throws IOException
ip - : int ip addressDataBlock instanceIOException - if reader db file errorpublic org.nutz.plugins.ip2region.DataBlock memorySearch(String ip) throws IOException
ip - : string ip addressDataBlock instanceIOException - if reader db file errorpublic org.nutz.plugins.ip2region.DataBlock getByIndexPtr(long ptr)
throws IOException
ptr - : index ptrDataBlock instanceIOException - if reader db file errorpublic org.nutz.plugins.ip2region.DataBlock btreeSearch(long ip)
throws IOException
ip - : int ip addressDataBlock instanceIOException - if reader db file errorpublic org.nutz.plugins.ip2region.DataBlock btreeSearch(String ip) throws IOException
ip - : string ip addressDataBlock instanceIOException - if reader db file errorpublic org.nutz.plugins.ip2region.DataBlock binarySearch(long ip)
throws IOException
ip - : int ip addressDataBlock instanceIOException - if reader db file errorpublic org.nutz.plugins.ip2region.DataBlock binarySearch(String ip) throws IOException
ip - : string ip addressDataBlock instanceIOException - if reader db file errorpublic RegionAddress getRegionAddress(String ip)
public RegionEnum getRegionByIp(String ip)
public boolean isMainlandIp(String ip)
Copyright © 2022. All rights reserved.