本文整理汇总了Java中jdbm.htree.HTree类的典型用法代码示例。如果您正苦于以下问题:Java HTree类的具体用法?Java HTree怎么用?Java HTree使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
HTree类属于jdbm.htree包,在下文中一共展示了HTree类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: FruitBasket
import jdbm.htree.HTree; //导入依赖的package包/类
public FruitBasket()
throws IOException
{
// create or open fruits record manager
Properties props = new Properties();
recman = RecordManagerFactory.createRecordManager( "fruits", props );
// create or load fruit basket (hashtable of fruits)
long recid = recman.getNamedObject( "basket" );
if ( recid != 0 ) {
System.out.println( "Reloading existing fruit basket..." );
hashtable = HTree.load( recman, recid );
showBasket();
} else {
System.out.println( "Creating new fruit basket..." );
hashtable = HTree.createInstance( recman );
recman.setNamedObject( "basket", hashtable.getRecid() );
}
}
示例2: init
import jdbm.htree.HTree; //导入依赖的package包/类
/**
* Initialize RecordManager and HTree
*/
protected void init()
throws IOException
{
recman = RecordManagerFactory.createRecordManager( jdbmName );
// create or reload HTree
long recid = recman.getNamedObject( name );
if ( recid == 0 ) {
hashtable = HTree.createInstance( recman );
recman.setNamedObject( name, hashtable.getRecid() );
} else {
hashtable = HTree.load( recman, recid );
}
}
示例3: loadPersistentMap
import jdbm.htree.HTree; //导入依赖的package包/类
public static HTree loadPersistentMap(RecordManager recman, String mapName) throws IOException {
long recid = recman.getNamedObject(mapName);
HTree ret;
if (recid != 0) {
ret = HTree.load(recman, recid);
} else {
ret = HTree.createInstance(recman);
recman.setNamedObject(mapName, ret.getRecid());
}
return ret;
}