50,706
社区成员
发帖
与我相关
我的任务
分享
import org.junit.Test;
import org.mapdb.BTreeMap;
import org.mapdb.DB;
import org.mapdb.DBMaker;
import org.mapdb.Serializer;
public class DBTest {
@Test
public void Test(){
DB db = DBMaker.fileDB("D:/data/tempdata/myDB")
.fileMmapEnable()
.fileMmapEnableIfSupported()
.fileMmapPreclearDisable()
.allocateIncrement(512 * 1024 * 1024)
.cleanerHackEnable()
.make();
BTreeMap<Long, int[]> myMap = db.treeMap("data")
.keySerializer(Serializer.LONG)
.valueSerializer(Serializer.INT_ARRAY)
.createOrOpen();
double x = 127.4521364;
double y = 56.1452147;
myMap.put(10001L, new int[]{(int)(x*1000000),(int)(y*1000000)});
int[] point = myMap.get(10001L);
System.err.println("Point("+point[0]/1000000d+","+point[1]/1000000d+")");
}
}