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


Java DataExternalizer类代码示例

本文整理汇总了Java中com.intellij.util.io.DataExternalizer的典型用法代码示例。如果您正苦于以下问题:Java DataExternalizer类的具体用法?Java DataExternalizer怎么用?Java DataExternalizer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: createDataExternalizer

import com.intellij.util.io.DataExternalizer; //导入依赖的package包/类
public static DataExternalizer<EnumeratedMethodIncompleteSignature> createDataExternalizer() {
  return new DataExternalizer<EnumeratedMethodIncompleteSignature>() {
    @Override
    public void save(@NotNull final DataOutput out, final EnumeratedMethodIncompleteSignature value) throws IOException {
      out.writeInt(value.getOwner());
      out.writeInt(value.getName());
      out.writeBoolean(value.isStatic());
    }

    @Override
    public EnumeratedMethodIncompleteSignature read(@NotNull final DataInput in) throws IOException {
      return new EnumeratedMethodIncompleteSignature(in.readInt(),
                                                     in.readInt(),
                                                     in.readBoolean());
    }
  };
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:EnumeratedMethodIncompleteSignature.java

示例2: ObjectObjectPersistentMultiMaplet

import com.intellij.util.io.DataExternalizer; //导入依赖的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);
      }
    }
  };
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:ObjectObjectPersistentMultiMaplet.java

示例3: IntObjectPersistentMultiMaplet

import com.intellij.util.io.DataExternalizer; //导入依赖的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);
      }
    }
  };
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:IntObjectPersistentMultiMaplet.java

示例4: getComputable

import com.intellij.util.io.DataExternalizer; //导入依赖的package包/类
@NotNull
private static ThrowableComputable<PersistentHashMap<String, Record>, IOException> getComputable(final File file) {
  return new ThrowableComputable<PersistentHashMap<String, Record>, IOException>() {
    @Override
    public PersistentHashMap<String, Record> compute() throws IOException {
      return new PersistentHashMap<String, Record>(file, new EnumeratorStringDescriptor(), new DataExternalizer<Record>() {
        @Override
        public void save(@NotNull DataOutput out, Record value) throws IOException {
          out.writeInt(value.magnitude);
          out.writeLong(value.date.getTime());
        }

        @Override
        public Record read(@NotNull DataInput in) throws IOException {
          return new Record(in.readInt(), new Date(in.readLong()));
        }
      });
    }
  };
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:TestStateStorage.java

示例5: saveTo

import com.intellij.util.io.DataExternalizer; //导入依赖的package包/类
@Override
public void saveTo(DataOutput out, DataExternalizer<Value> externalizer) throws IOException {
  if (needsCompacting()) {
    getMergedData().saveTo(out, externalizer);
  } else {
    final TIntHashSet set = myInvalidated;
    if (set != null && set.size() > 0) {
      for (int inputId : set.toArray()) {
        DataInputOutputUtil.writeINT(out, -inputId); // mark inputId as invalid, to be processed on load in ValueContainerImpl.readFrom
      }
    }

    final ValueContainer<Value> toAppend = getAddedDelta();
    if (toAppend != null && toAppend.size() > 0) {
      toAppend.saveTo(out, externalizer);
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:ChangeTrackingValueContainer.java

示例6: getValueExternalizer

import com.intellij.util.io.DataExternalizer; //导入依赖的package包/类
@NotNull
@Override
public DataExternalizer<XsdNamespaceBuilder> getValueExternalizer() {
  return new DataExternalizer<XsdNamespaceBuilder>() {
    @Override
    public void save(@NotNull DataOutput out, XsdNamespaceBuilder value) throws IOException {
      IOUtil.writeUTF(out, value.getNamespace() == null ? "" : value.getNamespace());
      IOUtil.writeUTF(out, value.getVersion() == null ? "" : value.getVersion());
      writeList(out, value.getTags());
      writeList(out, value.getRootTags());
    }

    @Override
    public XsdNamespaceBuilder read(@NotNull DataInput in) throws IOException {

      return new XsdNamespaceBuilder(IOUtil.readUTF(in),
                                     IOUtil.readUTF(in),
                                     readList(in),
                                     readList(in));
    }
  };
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:XmlNamespaceIndex.java

示例7: getValueExternalizer

import com.intellij.util.io.DataExternalizer; //导入依赖的package包/类
@NotNull
@Override
public DataExternalizer<CMakeCommandExpr> getValueExternalizer() {
    return new DataExternalizer<CMakeCommandExpr>() {
        @Override
        public void save(@NotNull DataOutput dataOutput, CMakeCommandExpr cMakeCommandExpr) throws IOException {
            dataOutput.writeChars(cMakeCommandExpr.getText());
        }

        @Override
        public CMakeCommandExpr read(@NotNull DataInput dataInput) throws IOException {
            // Create new file from string content and return first file element
            // TODO:
            String name = "test.dummy.cmake";
            CMakeFile tmp = (CMakeFile) PsiFileFactory.getInstance(null).
                    createFileFromText(name, CMakeFileType.INSTANCE, dataInput.readLine());
            return (CMakeCommandExpr) tmp.getFirstChild().getFirstChild().getFirstChild();
        }
    };
}
 
开发者ID:dubrousky,项目名称:CMaker,代码行数:21,代码来源:CMakeFileIndexExtension.java

示例8: ObjectObjectPersistentMultiMaplet

import com.intellij.util.io.DataExternalizer; //导入依赖的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);
      }
    }
  };
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:21,代码来源:ObjectObjectPersistentMultiMaplet.java

示例9: IntObjectPersistentMaplet

import com.intellij.util.io.DataExternalizer; //导入依赖的package包/类
public IntObjectPersistentMaplet(final File file, final DataExternalizer<V> externalizer) {
  try {
    myMap = new PersistentHashMap<Integer, V>(file, new IntInlineKeyDescriptor(), externalizer);
    myCache = new SLRUCache<Integer, Object>(CACHE_SIZE, CACHE_SIZE) {
      @NotNull
      @Override
      public Object createValue(Integer key) {
        try {
          final V v1 = myMap.get(key);
          return v1 == null? NULL_OBJ : v1;
        }
        catch (IOException e) {
          throw new RuntimeException(e);
        }
      }
    };
  }
  catch (IOException e) {
    throw new RuntimeException(e);
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:22,代码来源:IntObjectPersistentMaplet.java

示例10: IntObjectPersistentMultiMaplet

import com.intellij.util.io.DataExternalizer; //导入依赖的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);
      }
    }
  };
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:21,代码来源:IntObjectPersistentMultiMaplet.java

示例11: ClassType

import com.intellij.util.io.DataExternalizer; //导入依赖的package包/类
ClassType(final DependencyContext context, final DataInput in) {
  try {
    className = in.readInt();
    final int size = in.readInt();
    if (size == 0) {
      typeArgs = EMPTY_TYPE_ARRAY;
    }
    else {
      typeArgs = new AbstractType[size];
      final DataExternalizer<AbstractType> externalizer = externalizer(context);
      for (int i = 0; i < size; i++) {
        typeArgs[i] = externalizer.read(in);
      }
    }
  }
  catch (IOException e) {
    throw new RuntimeException(e);
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:20,代码来源:TypeRepr.java

示例12: createDataExternalizer

import com.intellij.util.io.DataExternalizer; //导入依赖的package包/类
public static DataExternalizer<MethodShortSignature> createDataExternalizer() {
  final EnumeratorStringDescriptor stringDescriptor = new EnumeratorStringDescriptor();
  return new DataExternalizer<MethodShortSignature>() {

    @Override
    public void save(final DataOutput out, final MethodShortSignature value) throws IOException {
      stringDescriptor.save(out, value.getName());
      stringDescriptor.save(out, value.getSignature());
    }

    @Override
    public MethodShortSignature read(final DataInput in) throws IOException {
      return new MethodShortSignature(stringDescriptor.read(in), stringDescriptor.read(in));
    }
  };
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:17,代码来源:MethodShortSignature.java

示例13: getValueExternalizer

import com.intellij.util.io.DataExternalizer; //导入依赖的package包/类
@Override
public DataExternalizer<XsdNamespaceBuilder> getValueExternalizer() {
  return new DataExternalizer<XsdNamespaceBuilder>() {
    @Override
    public void save(DataOutput out, XsdNamespaceBuilder value) throws IOException {
      out.writeUTF(value.getNamespace() == null ? "" : value.getNamespace());
      out.writeUTF(value.getVersion() == null ? "" : value.getVersion());
      out.writeInt(value.getTags().size());
      for (String s : value.getTags()) {
        out.writeUTF(s);
      }
    }

    @Override
    public XsdNamespaceBuilder read(DataInput in) throws IOException {

      int count;
      XsdNamespaceBuilder builder = new XsdNamespaceBuilder(in.readUTF(), in.readUTF(), new ArrayList<String>(count = in.readInt()));
      for (int i = 0; i < count; i++) {
        builder.getTags().add(in.readUTF());
      }
      return builder;
    }
  };
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:26,代码来源:XmlNamespaceIndex.java

示例14: VcsLogFullDetailsIndex

import com.intellij.util.io.DataExternalizer; //导入依赖的package包/类
public VcsLogFullDetailsIndex(@Nonnull String logId,
                              @Nonnull String name,
                              final int version,
                              @Nonnull DataIndexer<Integer, T, VcsFullCommitDetails> indexer,
                              @Nonnull DataExternalizer<T> externalizer,
                              @Nonnull FatalErrorHandler fatalErrorHandler,
                              @Nonnull Disposable disposableParent)
        throws IOException {
  myID = ID.create(name);
  myName = name;
  myLogId = logId;
  myIndexer = indexer;
  myFatalErrorHandler = fatalErrorHandler;

  myMapReduceIndex = new MyMapReduceIndex(myIndexer, externalizer, version);

  Disposer.register(disposableParent, this);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:19,代码来源:VcsLogFullDetailsIndex.java

示例15: saveTo

import com.intellij.util.io.DataExternalizer; //导入依赖的package包/类
@Override
public void saveTo(DataOutput out, DataExternalizer<Value> externalizer) throws IOException {
  if (needsCompacting()) {
    getMergedData().saveTo(out, externalizer);
  } else {
    final TIntHashSet set = myInvalidated;
    if (set != null && set.size() > 0) {
      for (int inputId : set.toArray()) {
        DataInputOutputUtil.writeINT(out, -inputId); // mark inputId as invalid, to be processed on load in ValueContainerImpl.readFrom
      }
    }

    final UpdatableValueContainer<Value> toAppend = getAddedDelta();
    if (toAppend != null && toAppend.size() > 0) {
      toAppend.saveTo(out, externalizer);
    }
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:19,代码来源:ChangeTrackingValueContainer.java


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