当前位置: 首页>>代码示例>>Java>>正文


Java Options.comparator方法代码示例

本文整理汇总了Java中org.iq80.leveldb.Options.comparator方法的典型用法代码示例。如果您正苦于以下问题:Java Options.comparator方法的具体用法?Java Options.comparator怎么用?Java Options.comparator使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.iq80.leveldb.Options的用法示例。


在下文中一共展示了Options.comparator方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: EzLevelDbTable

import org.iq80.leveldb.Options; //导入方法依赖的package包/类
public EzLevelDbTable(File path, EzLevelDbFactory factory,
		Serde<H> hashKeySerde, Serde<R> rangeKeySerde, Serde<V> valueSerde,
		Comparator<byte[]> hashKeyComparator,
		Comparator<byte[]> rangeKeyComparator) {
	this.hashKeySerde = hashKeySerde;
	this.rangeKeySerde = rangeKeySerde;
	this.valueSerde = valueSerde;
	this.hashKeyComparator = hashKeyComparator;
	this.rangeKeyComparator = rangeKeyComparator;

	Options options = new Options();
	options.createIfMissing(true);
	options.comparator(new EzLevelDbComparator(hashKeyComparator,
			rangeKeyComparator));

	try {
		this.db = factory.open(path, options);
	} catch (IOException e) {
		throw new DbException(e);
	}
}
 
开发者ID:criccomini,项目名称:ezdb,代码行数:22,代码来源:EzLevelDbTable.java

示例2: makeEmptyMap

import org.iq80.leveldb.Options; //导入方法依赖的package包/类
@Override
protected SortedMap<String, String> makeEmptyMap() throws UnsupportedOperationException
{
	FileUtils.deleteRecursively(empty);

	Options options = new Options();
	options.createIfMissing(true);
	EntryBinding<String> stringBinding = new StringBinding();
	DBComparator comp = new LevelDBStoredSortedMap.BindedDBComparator<String>(stringBinding);
	options.comparator(comp);
	DB db = null;
	try
	{
		db = factory.open(empty, options);
	}
	catch (IOException e)
	{
		e.printStackTrace();
	}

	return new LevelDBStoredSortedMap<String, String>(db, comp, stringBinding, stringBinding);
}
 
开发者ID:GridLine,项目名称:leveldb-mapapi,代码行数:23,代码来源:SortedMapTest.java

示例3: makePopulatedMap

import org.iq80.leveldb.Options; //导入方法依赖的package包/类
@Override
protected SortedMap<String, String> makePopulatedMap() throws UnsupportedOperationException
{
	FileUtils.deleteRecursively(populated);

	Options options = new Options();
	options.createIfMissing(true);
	EntryBinding<String> stringBinding = new StringBinding();
	DBComparator comp = new LevelDBStoredSortedMap.BindedDBComparator<String>(stringBinding);
	options.comparator(comp);
	DB db = null;
	try
	{
		db = factory.open(populated, options);
	}
	catch (IOException e)
	{
		e.printStackTrace();
	}

	LevelDBStoredSortedMap<String, String> result = new LevelDBStoredSortedMap<String, String>(db, comp,
			stringBinding, stringBinding);
	result.put("test", "gridline");
	result.put("key", "value");
	return result;
}
 
开发者ID:GridLine,项目名称:leveldb-mapapi,代码行数:27,代码来源:SortedMapTest.java

示例4: createSortedMap

import org.iq80.leveldb.Options; //导入方法依赖的package包/类
/**
 * Returns a StoredSortedMap which is backed by a DB in the specified directory and sorted using the natural order of
 * the keys.
 * @param directory The directory in which the database is or will be created
 * @param keyBinding An EntryBinding implementation which is used to convert the keys
 * @param valueBinding An EntryBinding implementation which is used to convert the values
 * @return A StoredSortedMap. The user is responsible for calling close() when the map is no longer needed.
 * @throws IOException
 */
public static <K, V> StoredSortedMap<K, V> createSortedMap(File directory, EntryBinding<K> keyBinding,
		EntryBinding<V> valueBinding) throws IOException
{
	DBComparator dbcomparator = new LevelDBStoredSortedMap.BindedDBComparator<K>(keyBinding);

	Options options = new Options();
	options.createIfMissing(true);
	options.comparator(dbcomparator);

	DB db = factory.open(directory, options);

	return createSortedMapForDB(db, dbcomparator, keyBinding, valueBinding);
}
 
开发者ID:GridLine,项目名称:leveldb-mapapi,代码行数:23,代码来源:LevelDBMapFactory.java


注:本文中的org.iq80.leveldb.Options.comparator方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。