String (@NotNull String protocol, @NotNull String protoSeparator) { int length = 0; List<CharSequence> names = new ArrayList<>(); VirtualFileSystemEntry v = this; for (; ; ) { VirtualDirectoryImpl parent = v.getParent(); if (parent == null) { break; } CharSequence name = v.getNameSequence(); if (length != 0) length++; length += name.length(); names.add(name); v = parent; } int protocolLength = protocol.length(); String rootPath = v.getPath(); int rootPathLength = rootPath.length(); length += protocolLength + protoSeparator.length() + rootPathLength; char[] path = new char[length]; CharArrayUtil.getChars(protocol, path, 0); CharArrayUtil.getChars(protoSeparator, path, protocolLength); int o = protocolLength + protoSeparator.length(); CharArrayUtil.getChars(rootPath, path, o, rootPathLength); o += rootPathLength; for (int i = names.size() - 1; i >= 1; i--) { CharSequence name = names.get(i); int nameLength = name.length(); CharArrayUtil.getChars(name, path, o, nameLength); o += nameLength; path[o++] = '/'; } CharSequence name = names.get(0); CharArrayUtil.getChars(name, path, o); return new String(path); }