本文整理匯總了Java中org.iq80.leveldb.Options.errorIfExists方法的典型用法代碼示例。如果您正苦於以下問題:Java Options.errorIfExists方法的具體用法?Java Options.errorIfExists怎麽用?Java Options.errorIfExists使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.iq80.leveldb.Options
的用法示例。
在下文中一共展示了Options.errorIfExists方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: LevelDBStore
import org.iq80.leveldb.Options; //導入方法依賴的package包/類
LevelDBStore(final File dbPath) throws IOException {
Options options = new Options();
options.createIfMissing(true);
options.errorIfExists(true);
db = JniDBFactory.factory.open(dbPath, options);
batch = db.createWriteBatch();
}
示例2: activateService
import org.iq80.leveldb.Options; //導入方法依賴的package包/類
@Override
public void activateService()
throws Exception
{
charset = Charset.forName( "UTF-8" );
configuration.refresh();
LevelDBEntityStoreConfiguration config = configuration.get();
// Choose flavour
String flavour = config.flavour().get();
DBFactory factory;
if( "jni".equalsIgnoreCase( flavour ) )
{
factory = newJniDBFactory();
}
else if( "java".equalsIgnoreCase( flavour ) )
{
factory = newJavaDBFactory();
}
else
{
factory = newDBFactory();
}
// Apply configuration
Options options = new Options();
options.createIfMissing( true );
if( config.blockRestartInterval().get() != null )
{
options.blockRestartInterval( config.blockRestartInterval().get() );
}
if( config.blockSize().get() != null )
{
options.blockSize( config.blockSize().get() );
}
if( config.cacheSize().get() != null )
{
options.cacheSize( config.cacheSize().get() );
}
if( config.compression().get() != null )
{
options.compressionType( config.compression().get()
? CompressionType.SNAPPY
: CompressionType.NONE );
}
if( config.maxOpenFiles().get() != null )
{
options.maxOpenFiles( config.maxOpenFiles().get() );
}
if( config.paranoidChecks().get() != null )
{
options.paranoidChecks( config.paranoidChecks().get() );
}
if( config.verifyChecksums().get() != null )
{
options.verifyChecksums( config.verifyChecksums().get() );
}
if( config.writeBufferSize().get() != null )
{
options.writeBufferSize( config.writeBufferSize().get() );
}
if( config.errorIfExists().get() != null )
{
options.errorIfExists( config.errorIfExists().get() );
}
// Open/Create the database
File dbFile = new File( fileConfig.dataDirectory(), descriptor.identity().toString() );
db = factory.open( dbFile, options );
}