Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import java.util.Collections;
import java.util.Deque;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.zip.ZipInputStream;

import org.apache.logging.log4j.LogManager;
Expand Down Expand Up @@ -62,6 +63,8 @@ public class DirectLinkingResourceStorageLoadable extends ResourceStorageLoadabl

private static final Logger LOG = LogManager.getLogger(DirectLinkingResourceStorageLoadable.class);

private static final Map<String, URI> resourceUriMap = new ConcurrentHashMap<>(100_000);
private static final Map<String, URI> fragmentUriMap = new ConcurrentHashMap<>(500_000);
private static final int SOURCE_BUFFER_CAPACITY = 0x10000; // 64 KiB

private final boolean loadNodeModel;
Expand Down Expand Up @@ -314,6 +317,29 @@ public InternalEObject loadEObject() throws IOException {
return result;
}

@Override
public URI readURI() throws IOException {
int id = readCompressedInt();
if (id == -1) {
return null;
} else {
URI uri;
if (uriList.size() <= id) {
String value = readSegmentedString();
uri = resolve(resourceUriMap.computeIfAbsent(value, key -> new DirectLinkingURI(key)));
uriList.add(uri);
} else {
uri = uriList.get(id);
}
String fragment = readSegmentedString();
if (fragment != null) {
uri = fragmentUriMap.computeIfAbsent(uri.toString() + '#' + fragment, key -> new DirectLinkingURI(key));
// uri = uri.appendFragment(fragment);
}
return uri;
}
}

@Override
protected void loadFeatureValue(final InternalEObject internalEObject, final EStructuralFeatureData eStructuralFeatureData) throws IOException {
try {
Expand Down
Loading
Loading