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


Java IOUtil类代码示例

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


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

示例1: save

import com.intellij.util.io.IOUtil; //导入依赖的package包/类
public void save(DataOutput out) throws IOException {
  lockData();
  try {
    out.writeInt(myDeletedPaths.size());
    for (String path : myDeletedPaths) {
      IOUtil.writeString(path, out);
    }
    out.writeInt(myFilesToRecompile.size());
    for (Map.Entry<BuildRootDescriptor, Set<File>> entry : myFilesToRecompile.entrySet()) {
      IOUtil.writeString(entry.getKey().getRootId(), out);
      final Set<File> files = entry.getValue();
      out.writeInt(files.size());
      for (File file : files) {
        IOUtil.writeString(FileUtil.toSystemIndependentName(file.getPath()), out);
      }
    }
  }
  finally {
    unlockData();
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:FilesDelta.java

示例2: load

import com.intellij.util.io.IOUtil; //导入依赖的package包/类
public void load(DataInputStream in, JpsModel model, final BuildRootIndex buildRootIndex) throws IOException {
  final TargetTypeRegistry registry = TargetTypeRegistry.getInstance();
  int typeCount = in.readInt();
  while (typeCount-- > 0) {
    final String typeId = IOUtil.readString(in);
    int targetCount = in.readInt();
    BuildTargetType<?> type = registry.getTargetType(typeId);
    BuildTargetLoader<?> loader = type != null ? type.createLoader(model) : null;
    while (targetCount-- > 0) {
      final String id = IOUtil.readString(in);
      boolean loaded = false;
      if (loader != null) {
        BuildTarget<?> target = loader.createTarget(id);
        if (target != null) {
          getDelta(target).load(in, target, buildRootIndex);
          myInitialScanPerformed.add(target);
          loaded = true;
        }
      }
      if (!loaded) {
        LOG.info("Skipping unknown target (typeId=" + typeId + ", type=" + type + ", id=" + id + ")");
        FilesDelta.skip(in);
      }
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:BuildFSState.java

示例3: save

import com.intellij.util.io.IOUtil; //导入依赖的package包/类
public synchronized void save() {
  try {
    FileUtil.createParentDirs(myTargetsFile);
    DataOutputStream output = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(myTargetsFile)));
    try {
      output.writeInt(0);
      output.writeInt(myTargetIds.size());
      for (Map.Entry<BuildTarget<?>, Integer> entry : myTargetIds.entrySet()) {
        IOUtil.writeString(entry.getKey().getId(), output);
        output.writeInt(entry.getValue());
      }
    }
    finally {
      output.close();
    }
  }
  catch (IOException e) {
    LOG.info("Cannot save " + myTargetType.getTypeId() + " targets data: " + e.getMessage(), e);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:BuildTargetTypeState.java

示例4: testReplaceWithEqualButNotSameKey

import com.intellij.util.io.IOUtil; //导入依赖的package包/类
public void testReplaceWithEqualButNotSameKey() throws IOException {
  File file = FileUtil.createTempFile(getTestDirectoryName(), null);
  ObjectObjectPersistentMultiMaplet<String, IntValueStreamable> maplet =
    new ObjectObjectPersistentMultiMaplet<String, IntValueStreamable>(file, new CaseInsensitiveEnumeratorStringDescriptor(),
                                                                      new IntValueExternalizer(),
                                                                      COLLECTION_FACTORY);
  try {
    maplet.put("a", new IntValueStreamable(1));
    assertEquals(1, assertOneElement(maplet.get("a")).value);
    maplet.replace("A", Collections.singletonList(new IntValueStreamable(2)));
    assertEquals(2, assertOneElement(maplet.get("a")).value);
  } finally {
    maplet.close();
    IOUtil.deleteAllFilesStartingWith(file);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:ObjectObjectPersistentMultiMapletTest.java

示例5: save

import com.intellij.util.io.IOUtil; //导入依赖的package包/类
public void save() throws IOException {
  final DataOutputStream output = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(myFile)));
  try {
    output.writeInt(VERSION);
    output.writeInt(myCompilerVersion);
    output.writeInt(myTarget2Id.size());

    for (Map.Entry<String, Integer> entry : myTarget2Id.entrySet()) {
      IOUtil.writeString(entry.getKey(), output);
      output.writeInt(entry.getValue());
    }
  }
  finally {
    output.close();
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:GenericCompilerPersistentData.java

示例6: VcsLogHashMapImpl

import com.intellij.util.io.IOUtil; //导入依赖的package包/类
public VcsLogHashMapImpl(@NotNull Project project, @NotNull Map<VirtualFile, VcsLogProvider> logProviders) throws IOException {
  cleanupOldNaming(project, logProviders);
  String logId = calcLogId(project, logProviders);
  final File mapFile = new File(LOG_CACHE_APP_DIR, logId + "." + VERSION);
  if (!mapFile.exists()) {
    IOUtil.deleteAllFilesStartingWith(new File(LOG_CACHE_APP_DIR, logId));
  }

  Disposer.register(project, this);
  myPersistentEnumerator = IOUtil.openCleanOrResetBroken(new ThrowableComputable<PersistentEnumerator<Hash>, IOException>() {
    @Override
    public PersistentEnumerator<Hash> compute() throws IOException {
      return new PersistentEnumerator<Hash>(mapFile, new MyHashKeyDescriptor(), Page.PAGE_SIZE);
    }
  }, mapFile);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:VcsLogHashMapImpl.java

示例7: getFrameworkIdOfBuildFile

import com.intellij.util.io.IOUtil; //导入依赖的package包/类
@Nullable
public static String getFrameworkIdOfBuildFile(VirtualFile file) {
  if (file instanceof NewVirtualFile) {
    final DataInputStream is = FRAMEWORK_FILE_ATTRIBUTE.readAttribute(file);
    if (is != null) {
      try {
        try {
          if (is.available() == 0) {
            return null;
          }
          return IOUtil.readString(is);
        }
        finally {
          is.close();
        }
      }
      catch (IOException e) {
        LOG.error(file.getPath(), e);
      }
    }
    return "";
  }
  return file.getUserData(FRAMEWORK_FILE_MARKER);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:ForcedBuildFileAttribute.java

示例8: forceBuildFile

import com.intellij.util.io.IOUtil; //导入依赖的package包/类
private static void forceBuildFile(VirtualFile file, @Nullable String value) {
  if (file instanceof NewVirtualFile) {
    final DataOutputStream os = FRAMEWORK_FILE_ATTRIBUTE.writeAttribute(file);
    try {
      try {
        IOUtil.writeString(StringUtil.notNullize(value), os);
      }
      finally {
        os.close();
      }
    }
    catch (IOException e) {
      LOG.error(e);
    }
  }
  else {
    file.putUserData(FRAMEWORK_FILE_MARKER, value);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:ForcedBuildFileAttribute.java

示例9: internParts

import com.intellij.util.io.IOUtil; //导入依赖的package包/类
@Nullable
protected SubstringWrapper[] internParts(String path, boolean forAddition) {
  int start = 0;
  boolean asBytes = forAddition && IOUtil.isAscii(path);
  List<SubstringWrapper> key = new ArrayList<SubstringWrapper>();
  SubstringWrapper flyweightKey = new SubstringWrapper();
  while (start < path.length()) {
    flyweightKey.findSubStringUntilNextSeparator(path, start);
    SubstringWrapper interned = myInternMap.get(flyweightKey);
    if (interned == null) {
      if (!forAddition) {
        return null;
      }
      myInternMap.add(interned = flyweightKey.createPersistentCopy(asBytes));
    }
    key.add(interned);
    start += flyweightKey.len;
  }
  return key.toArray(new SubstringWrapper[key.size()]);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:PathInterner.java

示例10: thingsWentWrongLetsReinitialize

import com.intellij.util.io.IOUtil; //导入依赖的package包/类
private void thingsWentWrongLetsReinitialize(IOException e) {
  try {
    if (myMap != null) {
      try {
        myMap.close();
      }
      catch (IOException ignore) {
      }
      IOUtil.deleteAllFilesStartingWith(myFile);
    }
    myMap = initializeMap();
    LOG.error("Repaired after crash", e);
  }
  catch (IOException e1) {
    LOG.error("Cannot repair", e1);
    myMap = null;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:TestStateStorage.java

示例11: getValueExternalizer

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

示例12: read

import com.intellij.util.io.IOUtil; //导入依赖的package包/类
@Nullable
@Override
public Set<MyResourceInfo> read(@NotNull DataInput in) throws IOException {
  final int size = DataInputOutputUtil.readINT(in);

  if (size < 0 || size > 65535) {
    // Something is very wrong; trigger an index rebuild
    throw new IOException("Corrupt Index: Size " + size);
  }

  if (size == 0) {
    return Collections.emptySet();
  }
  final Set<MyResourceInfo> result = Sets.newHashSetWithExpectedSize(size);

  for (int i = 0; i < size; i++) {
    final String type = IOUtil.readUTF(in);
    final String name = IOUtil.readUTF(in);
    final String context = IOUtil.readUTF(in);
    final int offset = DataInputOutputUtil.readINT(in);
    result.add(new MyResourceInfo(new ResourceEntry(type, name, context), offset));
  }
  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:AndroidValueResourcesIndex.java

示例13: visitFile

import com.intellij.util.io.IOUtil; //导入依赖的package包/类
@Override
public boolean visitFile(VirtualFile file) {
    file.putUserData(MODIFICATION_DATE_KEY, null);
    if(file instanceof NewVirtualFile) {
        final DataOutputStream os = MODIFICATION_STAMP_FILE_ATTRIBUTE.writeAttribute(file);
        try {
            try {
                IOUtil.writeString(StringUtil.notNullize("0"), os);
            } finally {
                os.close();
            }
        } catch(IOException e) {
            // Ignore it but we might need to throw an exception
            String message = e.getMessage();
        }
    }
    return recursive;
}
 
开发者ID:headwirecom,项目名称:aem-ide-tooling-4-intellij,代码行数:19,代码来源:Util.java

示例14: setModificationStamp

import com.intellij.util.io.IOUtil; //导入依赖的package包/类
public static void setModificationStamp(VirtualFile file) {
    // Store it in memory first
    if(file != null) {
        file.putUserData(Util.MODIFICATION_DATE_KEY, file.getTimeStamp());
        if(file instanceof NewVirtualFile) {
            final DataOutputStream os = MODIFICATION_STAMP_FILE_ATTRIBUTE.writeAttribute(file);
            try {
                try {
                    IOUtil.writeString(StringUtil.notNullize(file.getTimeStamp() + ""), os);
                } finally {
                    os.close();
                }
            } catch(IOException e) {
                // Ignore it but we might need to throw an exception
                String message = e.getMessage();
            }
        }
    }
}
 
开发者ID:headwirecom,项目名称:aem-ide-tooling-4-intellij,代码行数:20,代码来源:Util.java

示例15: save

import com.intellij.util.io.IOUtil; //导入依赖的package包/类
public void save(DataOutput out) throws IOException {
  out.writeInt(myDeletedPaths.size());
  synchronized (myDeletedPaths) {
    for (String path : myDeletedPaths) {
      IOUtil.writeString(path, out);
    }
  }
  synchronized (myFilesToRecompile) {
    out.writeInt(myFilesToRecompile.size());
    for (Map.Entry<BuildRootDescriptor, Set<File>> entry : myFilesToRecompile.entrySet()) {
      IOUtil.writeString(entry.getKey().getRootId(), out);
      final Set<File> files = entry.getValue();
      out.writeInt(files.size());
      for (File file : files) {
        IOUtil.writeString(FileUtil.toSystemIndependentName(file.getPath()), out);
      }
    }
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:20,代码来源:FilesDelta.java


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