+ /**
+ * Shortens the given URI by removing scheme and key-type prefixes.
+ *
+ * @param uri
+ * The URI to shorten
+ * @return The shortened URI
+ */
+ private String shortenURI(String uri) {
+ String shortUri = uri;
+ if (shortUri.startsWith("freenet:")) {
+ shortUri = shortUri.substring("freenet:".length());
+ }
+ if (shortUri.startsWith("SSK@")) {
+ shortUri = shortUri.substring("SSK@".length());
+ }
+ if (shortUri.startsWith("USK@")) {
+ shortUri = shortUri.substring("USK@".length());
+ }
+ if (shortUri.endsWith("/")) {
+ shortUri = shortUri.substring(0, shortUri.length() - 1);
+ }
+ return shortUri;
+ }
+
+ /**
+ * Shortens the name of the given file by removing the local path of the
+ * project and leading file separators.
+ *
+ * @param file
+ * The file whose name should be shortened
+ * @return The shortened name of the file
+ */