本文整理汇总了Java中com.intellij.util.io.KeyDescriptor类的典型用法代码示例。如果您正苦于以下问题:Java KeyDescriptor类的具体用法?Java KeyDescriptor怎么用?Java KeyDescriptor使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
KeyDescriptor类属于com.intellij.util.io包,在下文中一共展示了KeyDescriptor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ObjectObjectPersistentMultiMaplet
import com.intellij.util.io.KeyDescriptor; //导入依赖的package包/类
public ObjectObjectPersistentMultiMaplet(final File file,
final KeyDescriptor<K> keyExternalizer,
final DataExternalizer<V> valueExternalizer,
final CollectionFactory<V> collectionFactory) throws IOException {
myValueExternalizer = valueExternalizer;
myMap = new PersistentHashMap<K, Collection<V>>(file, keyExternalizer, new CollectionDataExternalizer<V>(valueExternalizer, collectionFactory));
myCache = new SLRUCache<K, Collection>(CACHE_SIZE, CACHE_SIZE, keyExternalizer) {
@NotNull
@Override
public Collection createValue(K key) {
try {
final Collection<V> collection = myMap.get(key);
return collection == null? NULL_COLLECTION : collection;
}
catch (IOException e) {
throw new BuildDataCorruptedException(e);
}
}
};
}
示例2: IntIntPersistentMultiMaplet
import com.intellij.util.io.KeyDescriptor; //导入依赖的package包/类
public IntIntPersistentMultiMaplet(final File file, final KeyDescriptor<Integer> keyExternalizer) throws IOException {
myMap = new PersistentHashMap<Integer, TIntHashSet>(file, keyExternalizer, new IntSetExternalizer());
myCache = new SLRUCache<Integer, TIntHashSet>(CACHE_SIZE, CACHE_SIZE) {
@NotNull
@Override
public TIntHashSet createValue(Integer key) {
try {
final TIntHashSet collection = myMap.get(key);
return collection == null? NULL_COLLECTION : collection;
}
catch (IOException e) {
throw new BuildDataCorruptedException(e);
}
}
};
}
示例3: IntObjectPersistentMultiMaplet
import com.intellij.util.io.KeyDescriptor; //导入依赖的package包/类
public IntObjectPersistentMultiMaplet(final File file,
final KeyDescriptor<Integer> keyExternalizer,
final DataExternalizer<V> valueExternalizer,
final CollectionFactory<V> collectionFactory) throws IOException {
myValueExternalizer = valueExternalizer;
myMap = new PersistentHashMap<Integer, Collection<V>>(file, keyExternalizer, new CollectionDataExternalizer<V>(valueExternalizer, collectionFactory));
myCache = new SLRUCache<Integer, Collection>(CACHE_SIZE, CACHE_SIZE) {
@NotNull
@Override
public Collection createValue(Integer key) {
try {
final Collection<V> collection = myMap.get(key);
return collection == null? NULL_COLLECTION : collection;
}
catch (IOException e) {
throw new BuildDataCorruptedException(e);
}
}
};
}
示例4: ObjectObjectPersistentMultiMaplet
import com.intellij.util.io.KeyDescriptor; //导入依赖的package包/类
public ObjectObjectPersistentMultiMaplet(final File file,
final KeyDescriptor<K> keyExternalizer,
final DataExternalizer<V> valueExternalizer,
final CollectionFactory<V> collectionFactory) throws IOException {
myValueExternalizer = valueExternalizer;
myMap = new PersistentHashMap<K, Collection<V>>(file, keyExternalizer, new CollectionDataExternalizer<V>(valueExternalizer, collectionFactory));
myCache = new SLRUCache<K, Collection>(CACHE_SIZE, CACHE_SIZE) {
@NotNull
@Override
public Collection createValue(K key) {
try {
final Collection<V> collection = myMap.get(key);
return collection == null? NULL_COLLECTION : collection;
}
catch (IOException e) {
throw new RuntimeException(e);
}
}
};
}
示例5: IntIntPersistentMultiMaplet
import com.intellij.util.io.KeyDescriptor; //导入依赖的package包/类
public IntIntPersistentMultiMaplet(final File file, final KeyDescriptor<Integer> keyExternalizer) throws IOException {
myMap = new PersistentHashMap<Integer, TIntHashSet>(file, keyExternalizer, new IntSetExternalizer());
myCache = new SLRUCache<Integer, TIntHashSet>(CACHE_SIZE, CACHE_SIZE) {
@NotNull
@Override
public TIntHashSet createValue(Integer key) {
try {
final TIntHashSet collection = myMap.get(key);
return collection == null? NULL_COLLECTION : collection;
}
catch (IOException e) {
throw new RuntimeException(e);
}
}
};
}
示例6: IntObjectPersistentMultiMaplet
import com.intellij.util.io.KeyDescriptor; //导入依赖的package包/类
public IntObjectPersistentMultiMaplet(final File file,
final KeyDescriptor<Integer> keyExternalizer,
final DataExternalizer<V> valueExternalizer,
final CollectionFactory<V> collectionFactory) throws IOException {
myValueExternalizer = valueExternalizer;
myMap = new PersistentHashMap<Integer, Collection<V>>(file, keyExternalizer, new CollectionDataExternalizer<V>(valueExternalizer, collectionFactory));
myCache = new SLRUCache<Integer, Collection>(CACHE_SIZE, CACHE_SIZE) {
@NotNull
@Override
public Collection createValue(Integer key) {
try {
final Collection<V> collection = myMap.get(key);
return collection == null? NULL_COLLECTION : collection;
}
catch (IOException e) {
throw new RuntimeException(e);
}
}
};
}
示例7: getKeyDescriptor
import com.intellij.util.io.KeyDescriptor; //导入依赖的package包/类
@NotNull
@Override
public KeyDescriptor<ConfigIndexKey> getKeyDescriptor() {
return new KeyDescriptor<ConfigIndexKey>() {
@Override
public int getHashCode(ConfigIndexKey configKey) {
return configKey.hashCode();
}
@Override
public boolean isEqual(ConfigIndexKey val1, ConfigIndexKey val2) {
return val1.equals(val2);
}
@Override
public void save(@NotNull DataOutput out, ConfigIndexKey value) throws IOException {
out.writeUTF(StringUtil.notNullize(value.getDirectoryName()));
out.writeUTF(StringUtil.notNullize(value.getConfigKey()));
}
@Override
public ConfigIndexKey read(@NotNull DataInput in) throws IOException {
return new ConfigIndexKey(in.readUTF(), in.readUTF());
}
};
}
示例8: ClassFilesIndexStorageBase
import com.intellij.util.io.KeyDescriptor; //导入依赖的package包/类
public ClassFilesIndexStorageBase(final File indexDir, final KeyDescriptor<K> keyDescriptor, final DataExternalizer<V> valueExternalizer)
throws IOException {
myIndexFile = getIndexFile(indexDir);
myKeyDescriptor = keyDescriptor;
myValueExternalizer = valueExternalizer;
initialize();
}
示例9: ClassFilesIndexStorageWriter
import com.intellij.util.io.KeyDescriptor; //导入依赖的package包/类
public ClassFilesIndexStorageWriter(final File indexDir,
final KeyDescriptor<K> keyDescriptor,
final DataExternalizer<V> valueExternalizer,
final Mappings mappings) throws IOException {
super(indexDir, keyDescriptor, valueExternalizer);
myMappings = mappings;
}
示例10: SmallMapSerializer
import com.intellij.util.io.KeyDescriptor; //导入依赖的package包/类
public SmallMapSerializer(final File file, final KeyDescriptor<K> keyDescriptor, final DataExternalizer<V> valueExternalizer) {
myFile = file;
myKeyDescriptor = keyDescriptor;
myValueExternalizer = valueExternalizer;
myMap = new HashMap<KeyWrapper<K>, V>();
init();
}
示例11: ValueContainerMap
import com.intellij.util.io.KeyDescriptor; //导入依赖的package包/类
ValueContainerMap(@NotNull final File file,
@NotNull KeyDescriptor<Key> keyKeyDescriptor,
@NotNull DataExternalizer<Value> valueExternalizer,
boolean keyIsUniqueForIndexedFile
) throws IOException {
super(file, keyKeyDescriptor, new ValueContainerExternalizer<Value>(valueExternalizer));
myValueExternalizer = valueExternalizer;
myKeyIsUniqueForIndexedFile = keyIsUniqueForIndexedFile;
}
示例12: IntIntPersistentMaplet
import com.intellij.util.io.KeyDescriptor; //导入依赖的package包/类
public IntIntPersistentMaplet(final File file, final KeyDescriptor<Integer> k) {
try {
myMap = new PersistentHashMap<Integer, Integer>(file, k, new DataExternalizer<Integer>() {
@Override
public void save(DataOutput out, Integer value) throws IOException {
out.writeInt(value);
}
@Override
public Integer read(DataInput in) throws IOException {
return in.readInt();
}
});
myCache = new SLRUCache<Integer, Object>(CACHE_SIZE, CACHE_SIZE) {
@NotNull
@Override
public Object createValue(Integer key) {
try {
final Integer v1 = myMap.get(key);
return v1 == null? NULL_OBJ : v1;
}
catch (IOException e) {
throw new RuntimeException(e);
}
}
};
}
catch (IOException e) {
throw new RuntimeException(e);
}
}
示例13: createDataExternalizer
import com.intellij.util.io.KeyDescriptor; //导入依赖的package包/类
public static DataExternalizer<CallingLocation> createDataExternalizer() {
final KeyDescriptor<MethodIncompleteSignature> methodIncompleteSignatureKeyDescriptor = MethodIncompleteSignature.createKeyDescriptor();
return new DataExternalizer<CallingLocation>() {
@Override
public void save(final DataOutput out, final CallingLocation value) throws IOException {
methodIncompleteSignatureKeyDescriptor.save(out, value.getMethodIncompleteSignature());
VariableType.KEY_DESCRIPTOR.save(out, value.getVariableType());
}
@Override
public CallingLocation read(final DataInput in) throws IOException {
return new CallingLocation(methodIncompleteSignatureKeyDescriptor.read(in), VariableType.KEY_DESCRIPTOR.read(in));
}
};
}
示例14: CachedPersistentHashMap
import com.intellij.util.io.KeyDescriptor; //导入依赖的package包/类
public CachedPersistentHashMap(File file, KeyDescriptor<Key> keyDescriptor, DataExternalizer<Value> valDescriptor, final int cacheSize) throws IOException {
super(file, keyDescriptor, valDescriptor);
myCache = new SLRUMap<Key,Value>(cacheSize * 2, cacheSize) {
protected void onDropFromCache(Key key, Value value) {
if (isValueDirty(value)) {
try {
CachedPersistentHashMap.super.put(key, value);
}
catch (IOException e) {
LOG.info(e);
}
}
}
};
}
示例15: MapIndexStorage
import com.intellij.util.io.KeyDescriptor; //导入依赖的package包/类
public MapIndexStorage(@NotNull File storageFile,
@NotNull KeyDescriptor<Key> keyDescriptor,
@NotNull DataExternalizer<Value> valueExternalizer,
final int cacheSize
) throws IOException {
this(storageFile, keyDescriptor, valueExternalizer, cacheSize, false);
}