コード例 #1
0
 void initializeState(String name) {
   assert !myBusy;
   myBusy = true;
   myNameLength = name.length();
   isAsciiName = IOUtil.isAscii(name);
   myTable.clear();
 }
コード例 #2
0
 @Override
 public void save(@NotNull DataOutput out, HaxeClassInfo classInfo) throws IOException {
   IOUtil.writeUTFFast(buffer, out, classInfo.getValue());
   final HaxeComponentType haxeComponentType = classInfo.getType();
   final int key = haxeComponentType == null ? -1 : haxeComponentType.getKey();
   out.writeInt(key);
 }
コード例 #3
0
 public void save(DataOutput out) throws IOException {
   final Set<Map.Entry<String, Long>> entries = myDependencies.entrySet();
   out.writeInt(entries.size());
   for (Map.Entry<String, Long> entry : entries) {
     IOUtil.writeString(entry.getKey(), out);
     out.writeLong(entry.getValue().longValue());
   }
 }
コード例 #4
0
ファイル: VcsLogHashMap.java プロジェクト: ngoanhtan/consulo
  VcsLogHashMap(@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);
  }
コード例 #5
0
 private int indexOfIgnoreCase(
     String name, int fromIndex, char p, int patternIndex, boolean isAsciiName) {
   if (isAsciiName && IOUtil.isAscii(p)) {
     char pUpper = toUpperCase[patternIndex];
     char pLower = toLowerCase[patternIndex];
     for (int i = fromIndex; i < name.length(); i++) {
       char c = name.charAt(i);
       if (c == p || toUpperAscii(c) == pUpper || toLowerAscii(c) == pLower) {
         return i;
       }
     }
     return -1;
   }
   return StringUtil.indexOfIgnoreCase(name, p, fromIndex);
 }
コード例 #6
0
/** @author: Fedor.Korotkov */
public class HaxeClassInfoExternalizer implements DataExternalizer<HaxeClassInfo> {
  private final byte[] buffer = IOUtil.allocReadWriteUTFBuffer();

  @Override
  public void save(@NotNull DataOutput out, HaxeClassInfo classInfo) throws IOException {
    IOUtil.writeUTFFast(buffer, out, classInfo.getValue());
    final HaxeComponentType haxeComponentType = classInfo.getType();
    final int key = haxeComponentType == null ? -1 : haxeComponentType.getKey();
    out.writeInt(key);
  }

  @Override
  public HaxeClassInfo read(@NotNull DataInput in) throws IOException {
    final String value = IOUtil.readUTFFast(buffer, in);
    final int key = in.readInt();
    return new HaxeClassInfo(value, HaxeComponentType.valueOf(key));
  }
}
コード例 #7
0
 @Override
 public HaxeClassInfo read(@NotNull DataInput in) throws IOException {
   final String value = IOUtil.readUTFFast(buffer, in);
   final int key = in.readInt();
   return new HaxeClassInfo(value, HaxeComponentType.valueOf(key));
 }