+ private static final Pattern whitespacePattern = Pattern.compile("[\\u000a\u0020\u00a0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u200b\u200c\u200d\u202f\u205f\u2060\u2800\u3000]");
+
+ /**
+ * Enumeration for all recognized link types.
+ *
+ * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
+ */
+ private enum LinkType {
+
+ /** Link is a KSK. */
+ KSK(true),
+
+ /** Link is a CHK. */
+ CHK(true),
+
+ /** Link is an SSK. */
+ SSK(true),
+
+ /** Link is a USK. */
+ USK(true),
+
+ /** Link is HTTP. */
+ HTTP(false),
+
+ /** Link is HTTPS. */
+ HTTPS(false);
+
+ /** Whether this link type links to freenet. */
+ private final boolean anonymous;
+
+ /**
+ * Creates a new link type.
+ *
+ * @param anonymous
+ * {@code true} if this link type links to freenet,
+ * {@code false} otherwise
+ */
+ private LinkType(boolean anonymous) {
+ this.anonymous = anonymous;
+ }
+
+ /**
+ * Returns whether this link type links anonymously to within freenet.
+ *
+ * @return {@code true} if this link type links to within freenet,
+ * {@code false} otherwise
+ */
+ public boolean isAnonymous() {
+ return anonymous;
+ }
+
+ }