提交 d190153d 编写于 作者: 如梦技术's avatar 如梦技术 🐛

🐛 修复 mica-ip2region b-tree算法查找 github #34.

上级 dc370af9
......@@ -165,7 +165,7 @@ public class DbSearcher {
if (HeaderSip == null) {
//reader.seek(8L); //pass the super block
//byte[] b = new byte[dbConfig.getTotalHeaderSize()];
byte[] b = new byte[4096];
byte[] b = new byte[8 * 1024];
//pass the super block
reader.readFully(8L, b, 0, b.length);
......
......@@ -3,7 +3,9 @@ package net.dreamlu.mica.ip2region.test;
import net.dreamlu.mica.ip2region.config.Ip2regionConfiguration;
import net.dreamlu.mica.ip2region.config.Ip2regionProperties;
import net.dreamlu.mica.ip2region.core.Ip2regionSearcher;
import net.dreamlu.mica.ip2region.core.IpInfo;
import net.dreamlu.mica.ip2region.impl.Ip2regionSearcherImpl;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
......@@ -35,4 +37,11 @@ public class Ip2regionTest {
System.out.println(searcher.memorySearch("223.29.220.0"));
System.out.println(searcher.memorySearch("82.120.124.0"));
}
@Test
public void test2() {
IpInfo ipInfo = searcher.btreeSearch("127.0.0.1");
Assert.assertNotNull(ipInfo);
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册