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


Java DataInputOutputUtil.writeINT方法代码示例

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


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

示例1: saveToFile

import com.intellij.util.io.DataInputOutputUtil; //导入方法依赖的package包/类
private void saveToFile(@NotNull T instance) throws IOException {
  FileOutputStream fileOutputStream = new FileOutputStream(myFile, true);
  DataOutputStream output = new DataOutputStream(new BufferedOutputStream(fileOutputStream));

  try {
    if (myFile.length() == 0) {
      DataInputOutputUtil.writeTIME(output, FSRecords.getCreationTimestamp());
      DataInputOutputUtil.writeINT(output, myVersion);
    }
    myKeyDescriptor.save(output, instance);
  } finally {
    try {
      output.close();
      fileOutputStream.getFD().sync();
    }  catch (IOException ignore) {}
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:VfsDependentEnum.java

示例2: save

import com.intellij.util.io.DataInputOutputUtil; //导入方法依赖的package包/类
@Override
public void save(@NotNull DataOutput out, TIntArrayList list) throws IOException {
  if (list.size() == 2) {
    DataInputOutputUtil.writeINT(out, list.getQuick(0));
    DataInputOutputUtil.writeINT(out, list.getQuick(1));
  }
  else {
    DataInputOutputUtil.writeINT(out, -list.size());
    int prev = 0;
    for (int i = 0, len = list.size(); i < len; i+=2) {
      int value = list.getQuick(i);
      DataInputOutputUtil.writeINT(out, value - prev);
      prev = value;
      DataInputOutputUtil.writeINT(out, list.getQuick(i + 1));
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:DuplicatesIndex.java

示例3: save

import com.intellij.util.io.DataInputOutputUtil; //导入方法依赖的package包/类
@Override
public void save(@NotNull final DataOutput out, @NotNull final StubIdList value) throws IOException {
  int size = value.size();
  if (size == 0) {
    DataInputOutputUtil.writeINT(out, Integer.MAX_VALUE);
  }
  else if (size == 1) {
    DataInputOutputUtil.writeINT(out, value.get(0)); // most often case
  }
  else {
    DataInputOutputUtil.writeINT(out, -size);
    for(int i = 0; i < size; ++i) {
      DataInputOutputUtil.writeINT(out, value.get(i));
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:StubIndexImpl.java

示例4: saveTo

import com.intellij.util.io.DataInputOutputUtil; //导入方法依赖的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

示例5: writeChange

import com.intellij.util.io.DataInputOutputUtil; //导入方法依赖的package包/类
public static void writeChange(DataOutput out, Change change) throws IOException {
  int id = -1;

  Class c = change.getClass();
  if (c.equals(CreateFileChange.class)) id = 1;
  if (c.equals(CreateDirectoryChange.class)) id = 2;
  if (c.equals(ContentChange.class)) id = 3;
  if (c.equals(RenameChange.class)) id = 4;
  if (c.equals(ROStatusChange.class)) id = 5;
  if (c.equals(MoveChange.class)) id = 6;
  if (c.equals(DeleteChange.class)) id = 7;
  if (c.equals(PutLabelChange.class)) id = 8;
  if (c.equals(PutSystemLabelChange.class)) id = 9;

  if (id == -1) throw new IOException("unexpected change type: " + c);

  DataInputOutputUtil.writeINT(out, id);
  change.write(out);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:StreamUtil.java

示例6: persistAttribute

import com.intellij.util.io.DataInputOutputUtil; //导入方法依赖的package包/类
@Override
public void persistAttribute(@NotNull VirtualFile fileOrDir, @NotNull LanguageLevel level) throws IOException {
  final DataInputStream iStream = PERSISTENCE.readAttribute(fileOrDir);
  if (iStream != null) {
    try {
      final int oldLevelOrdinal = DataInputOutputUtil.readINT(iStream);
      if (oldLevelOrdinal == level.ordinal()) return;
    }
    finally {
      iStream.close();
    }
  }

  final DataOutputStream oStream = PERSISTENCE.writeAttribute(fileOrDir);
  DataInputOutputUtil.writeINT(oStream, level.ordinal());
  oStream.close();

  for (VirtualFile child : fileOrDir.getChildren()) {
    if (!child.isDirectory() && StdFileTypes.JAVA.equals(child.getFileType())) {
      FileBasedIndex.getInstance().requestReindex(child);
    }
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:24,代码来源:JavaLanguageLevelPusher.java

示例7: writeCompressed

import com.intellij.util.io.DataInputOutputUtil; //导入方法依赖的package包/类
public static int writeCompressed(DataOutput out, byte[] bytes, int length) throws IOException {
  if (length > COMPRESSION_THRESHOLD && ourCanUseSnappy) {
    SoftReference<byte[]> reference = spareBufferLocal.get();
    byte[] compressedOutputBuffer = reference != null ? reference.get():null;
    int maxCompressedSize = 32 + length + length / 6; // snappy.cc#MaxCompressedLength
    if (compressedOutputBuffer == null || compressedOutputBuffer.length < maxCompressedSize) {
      compressedOutputBuffer = new byte[maxCompressedSize];
      spareBufferLocal.set(new SoftReference<byte[]>(compressedOutputBuffer));
    }
    int compressedSize = Snappy.rawCompress(bytes, 0, length, compressedOutputBuffer, 0);
    DataInputOutputUtil.writeINT(out, -compressedSize);
    out.write(compressedOutputBuffer, 0, compressedSize);
    return compressedSize;
  } else {
    DataInputOutputUtil.writeINT(out, length);
    out.write(bytes, 0, length);
    return length;
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:20,代码来源:CompressionUtil.java

示例8: save

import com.intellij.util.io.DataInputOutputUtil; //导入方法依赖的package包/类
@Override
public void save(final DataOutput out, @NotNull final StubIdList value) throws IOException {
  int size = value.size();
  if (size == 0) {
    DataInputOutputUtil.writeINT(out, Integer.MAX_VALUE);
  }
  else if (size == 1) {
    DataInputOutputUtil.writeINT(out, value.get(0)); // most often case
  }
  else {
    DataInputOutputUtil.writeINT(out, -size);
    for(int i = 0; i < size; ++i) {
      DataInputOutputUtil.writeINT(out, value.get(i));
    }
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:17,代码来源:StubIndexImpl.java

示例9: saveToFile

import com.intellij.util.io.DataInputOutputUtil; //导入方法依赖的package包/类
private void saveToFile(@Nonnull T instance) throws IOException {
  FileOutputStream fileOutputStream = new FileOutputStream(myFile, true);
  DataOutputStream output = new DataOutputStream(new BufferedOutputStream(fileOutputStream));

  try {
    if (myFile.length() == 0) {
      DataInputOutputUtil.writeTIME(output, FSRecords.getCreationTimestamp());
      DataInputOutputUtil.writeINT(output, myVersion);
    }
    myKeyDescriptor.save(output, instance);
  } finally {
    try {
      output.close();
      fileOutputStream.getFD().sync();
    }  catch (IOException ignore) {}
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:18,代码来源:VfsDependentEnum.java

示例10: writeCompressedWithoutOriginalBufferLength

import com.intellij.util.io.DataInputOutputUtil; //导入方法依赖的package包/类
public static int writeCompressedWithoutOriginalBufferLength(@Nonnull DataOutput out, @Nonnull byte[] bytes, int length) throws IOException {
  long started = System.nanoTime();

  final byte[] compressedOutputBuffer = spareBufferLocal.getBuffer(Snappy.maxCompressedLength(length));
  int compressedSize = Snappy.compress(bytes, 0, length, compressedOutputBuffer, 0);

  final long time = System.nanoTime() - started;
  mySizeAfterCompression.addAndGet(compressedSize);
  mySizeBeforeCompression.addAndGet(length);
  int requests = myCompressionRequests.incrementAndGet();
  long l = myCompressionTime.addAndGet(time);

  if (DUMP_COMPRESSION_STATS && requests % 1000  == 0) {
    System.out.println("Compressed " + requests + " times, size:" + mySizeBeforeCompression + "->" + mySizeAfterCompression + " for " + (l  / 1000000) + "ms");
  }

  DataInputOutputUtil.writeINT(out, compressedSize);
  out.write(compressedOutputBuffer, 0, compressedSize);

  return compressedSize;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:22,代码来源:CompressionUtil.java

示例11: saveTo

import com.intellij.util.io.DataInputOutputUtil; //导入方法依赖的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

示例12: save

import com.intellij.util.io.DataInputOutputUtil; //导入方法依赖的package包/类
@Override
public void save(@Nonnull final DataOutput out, @Nonnull final StubIdList value) throws IOException {
  int size = value.size();
  if (size == 0) {
    DataInputOutputUtil.writeINT(out, Integer.MAX_VALUE);
  }
  else if (size == 1) {
    DataInputOutputUtil.writeINT(out, value.get(0)); // most often case
  }
  else {
    DataInputOutputUtil.writeINT(out, -size);
    for(int i = 0; i < size; ++i) {
      DataInputOutputUtil.writeINT(out, value.get(i));
    }
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:17,代码来源:StubIndexImpl.java

示例13: doSerialize

import com.intellij.util.io.DataInputOutputUtil; //导入方法依赖的package包/类
private void doSerialize(@Nonnull Stub rootStub, @Nonnull StubOutputStream stream) throws IOException {
  final ObjectStubSerializer serializer = StubSerializationUtil.getSerializer(rootStub);

  if (((ObjectStubBase)rootStub).isDangling()) {
    stream.writeByte(0);
  }
  DataInputOutputUtil.writeINT(stream, getClassId(serializer));
  serializer.serialize(rootStub, stream);

  final List<? extends Stub> children = rootStub.getChildrenStubs();
  final int childrenSize = children.size();
  DataInputOutputUtil.writeINT(stream, childrenSize);
  for (int i = 0; i < childrenSize; ++i) {
    doSerialize(children.get(i), stream);
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:17,代码来源:StubSerializationHelper.java

示例14: write

import com.intellij.util.io.DataInputOutputUtil; //导入方法依赖的package包/类
public void write(DataOutput out) throws IOException {
  LocalHistoryLog.LOG.assertTrue(isLocked, "Changeset should be locked");
  DataInputOutputUtil.writeLONG(out, myId);
  StreamUtil.writeStringOrNull(out, myName);
  DataInputOutputUtil.writeTIME(out, myTimestamp);

  DataInputOutputUtil.writeINT(out, myChanges.size());
  for (Change c : myChanges) {
    StreamUtil.writeChange(out, c);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:ChangeSet.java

示例15: save

import com.intellij.util.io.DataInputOutputUtil; //导入方法依赖的package包/类
public static <X> void save(final Collection<X> x, final DataExternalizer<X> e, final DataOutput out) {
  try {
    DataInputOutputUtil.writeINT(out, x.size());

    for (X y : x) {
      e.save(out, y);
    }
  }
  catch (IOException c) {
    throw new BuildDataCorruptedException(c);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:RW.java


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