當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。