📄 defaultindexkeycreator.java
字号:
package com.pub.berkeleydb;
import com.sleepycat.je.DatabaseEntry;
import org.apache.mina.common.*;
//import java.nio.ByteBuffer;
/**
*
*/
public abstract class DefaultIndexKeyCreator implements IIndexCreator {
//index key ByteBuffer
private static ThreadLocal tlIKB = new ThreadLocal(){
protected Object initialValue() {
return ByteBuffer.allocate(256,false).setAutoExpand( true );
}
};
public static ByteBuffer tmpIKB(){return (ByteBuffer)tlIKB.get();}
public boolean toIndexKey(Object r, DatabaseEntry idxKey) {
ByteBuffer out = tmpIKB();
out.clear();
toIndexKey(out,r);
out.flip();
idxKey.setData(out.array(), out.position(), out.remaining());
out = null;
return true;
}
protected abstract void toIndexKey(ByteBuffer out, Object o);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -