void initializeState(String name) { assert !myBusy; myBusy = true; myNameLength = name.length(); isAsciiName = IOUtil.isAscii(name); myTable.clear(); }
@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); }
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()); } }
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); }
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); }
/** @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)); } }
@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)); }