Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

hack to reduce resource contention caused by massive UTF8 decodings which use java.nio resources: used a ASCII String <-> byte[] conversion wherever possible. Many Strings in YaCy are hashes which are pure ASCII (base64 hashes). The new ASCII String <-> byte[] conversion method have less computation overhead than the UTF8 conversion.

orbiter4bea3f97143b
diff --git a/htroot/Bookmarks.java b/htroot/Bookmarks.java
index 1147c8cc9..473bf6438 100644
--- a/htroot/Bookmarks.java
+++ b/htroot/Bookmarks.java
@@ -38,7 +38,7 @@ import java.util.Iterator;
import java.util.Set;
import net.yacy.cora.date.ISO8601Formatter;
-import net.yacy.cora.document.UTF8;
+import net.yacy.cora.document.ASCII;
import net.yacy.cora.protocol.HeaderFramework;
import net.yacy.cora.protocol.RequestHeader;
import net.yacy.document.Document;
@@ -196,7 +196,7 @@ public class Bookmarks {
final BookmarksDB.Bookmark bookmark = sb.bookmarksDB.getBookmark(urlHash);
if (bookmark == null) {
// try to get the bookmark from the LURL database
- final URIMetadataRow urlentry = sb.indexSegments.urlMetadata(Segments.Process.PUBLIC).load(UTF8.getBytes(urlHash));
+ final URIMetadataRow urlentry = sb.indexSegments.urlMetadata(Segments.Process.PUBLIC).load(ASCII.getBytes(urlHash));
if (urlentry != null) try {
final URIMetadataRow.Components metadata = urlentry.metadata();
final Document document = Document.mergeDocuments(metadata.url(), null, sb.loader.loadDocuments(sb.loader.request(metadata.url(), true, false), CrawlProfile.CacheStrategy.IFEXIST, 5000, Long.MAX_VALUE));
diff --git a/htroot/ConfigNetwork_p.java b/htroot/ConfigNetwork_p.java
index 5dee5527b..42e239a71 100644
--- a/htroot/ConfigNetwork_p.java
+++ b/htroot/ConfigNetwork_p.java
@@ -30,7 +30,7 @@ import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Set;
-import net.yacy.cora.document.UTF8;
+import net.yacy.cora.document.ASCII;
import net.yacy.cora.protocol.RequestHeader;
import net.yacy.kelondro.util.FileUtils;
import net.yacy.kelondro.util.MapTools;
@@ -172,7 +172,7 @@ public class ConfigNetwork_p {
prop.putHTML("cluster.peers.yacydomain", sb.getConfig("cluster.peers.yacydomain", ""));
StringBuilder hashes = new StringBuilder();
for (final byte[] h : sb.clusterhashes.keySet()) {
- hashes.append(", ").append(UTF8.String(h));
+ hashes.append(", ").append(ASCII.String(h));
}
if (hashes.length() > 2) {
hashes = hashes.delete(0, 2);
diff --git a/htroot/CrawlResults.java b/htroot/CrawlResults.java
index f20e7f8e6..d5e24eea1 100644
--- a/htroot/CrawlResults.java
+++ b/htroot/CrawlResults.java
@@ -31,6 +31,7 @@ import java.util.Iterator;
import java.util.Locale;
import java.util.Map;
+import net.yacy.cora.document.ASCII;
import net.yacy.cora.document.UTF8;
import net.yacy.cora.protocol.RequestHeader;
import net.yacy.kelondro.data.meta.DigestURI;
@@ -194,8 +195,8 @@ public class CrawlResults {
urlstr = metadata.url().toNormalform(false, true);
urltxt = nxTools.shortenURLString(urlstr, 72); // shorten the string text like a URL
- initiatorSeed = entry.getValue() == null || entry.getValue().initiatorHash == null ? null : sb.peers.getConnected(UTF8.String(entry.getValue().initiatorHash));
- executorSeed = entry.getValue() == null || entry.getValue().executorHash == null ? null : sb.peers.getConnected(UTF8.String(entry.getValue().executorHash));
+ initiatorSeed = entry.getValue() == null || entry.getValue().initiatorHash == null ? null : sb.peers.getConnected(ASCII.String(entry.getValue().initiatorHash));
+ executorSeed = entry.getValue() == null || entry.getValue().executorHash == null ? null : sb.peers.getConnected(ASCII.String(entry.getValue().executorHash));
prop.put("table_indexed_" + cnt + "_dark", (dark) ? "1" : "0");
prop.put("table_indexed_" + cnt + "_feedbackpage", "CrawlResults.html");
diff --git a/htroot/CrawlStartScanner_p.java b/htroot/CrawlStartScanner_p.java
index d738c31b8..8a2b7816a 100644
--- a/htroot/CrawlStartScanner_p.java
+++ b/htroot/CrawlStartScanner_p.java
@@ -28,7 +28,7 @@ import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
-import net.yacy.cora.document.UTF8;
+import net.yacy.cora.document.ASCII;
import net.yacy.cora.protocol.Domains;
import net.yacy.cora.protocol.RequestHeader;
import net.yacy.cora.protocol.Scanner;
@@ -229,7 +229,7 @@ public class CrawlStartScanner_p {
try {
u = new DigestURI(host.getKey().url());
urlString = u.toNormalform(true, false);
- prop.put("servertable_list_" + i + "_pk", UTF8.String(u.hash()));
+ prop.put("servertable_list_" + i + "_pk", ASCII.String(u.hash()));
prop.put("servertable_list_" + i + "_count", i);
prop.putHTML("servertable_list_" + i + "_protocol", u.getProtocol());
prop.putHTML("servertable_list_" + i + "_ip", host.getKey().getInetAddress().getHostAddress());
diff --git a/htroot/IndexCleaner_p.java b/htroot/IndexCleaner_p.java
index d2f3ffba5..62c2c148f 100755
--- a/htroot/IndexCleaner_p.java
+++ b/htroot/IndexCleaner_p.java
@@ -24,7 +24,7 @@
//along with this program; if not, write to the Free Software
//Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-import net.yacy.cora.document.UTF8;
+import net.yacy.cora.document.ASCII;
import net.yacy.cora.protocol.RequestHeader;
import de.anomic.search.MetadataRepository;
import de.anomic.search.Segment;
@@ -108,8 +108,8 @@ public class IndexCleaner_p {
prop.put("rwidb_threadToString", indexCleanerThread.toString());
prop.putNum("rwidb_RWIcountstart", indexCleanerThread.rwiCountAtStart);
prop.putNum("rwidb_RWIcountnow", indexCleanerThread.rwisize());
- prop.put("rwidb_wordHashNow", (indexCleanerThread.wordHashNow == null) ? "NULL" : UTF8.String(indexCleanerThread.wordHashNow));
- prop.put("rwidb_lastWordHash", (indexCleanerThread.lastWordHash == null) ? "null" : UTF8.String(indexCleanerThread.lastWordHash));
+ prop.put("rwidb_wordHashNow", (indexCleanerThread.wordHashNow == null) ? "NULL" : ASCII.String(indexCleanerThread.wordHashNow));
+ prop.put("rwidb_lastWordHash", (indexCleanerThread.lastWordHash == null) ? "null" : ASCII.String(indexCleanerThread.lastWordHash));
prop.putNum("rwidb_lastDeletionCounter", indexCleanerThread.lastDeletionCounter);
}
diff --git a/htroot/IndexControlRWIs_p.java b/htroot/IndexControlRWIs_p.java
index c7607ebf0..1fe9dcf0b 100644
--- a/htroot/IndexControlRWIs_p.java
+++ b/htroot/IndexControlRWIs_p.java
@@ -37,6 +37,7 @@ import java.util.TreeMap;
import net.yacy.cora.date.GenericFormatter;
import net.yacy.cora.document.UTF8;
import net.yacy.cora.protocol.RequestHeader;
+import net.yacy.cora.document.ASCII;
import net.yacy.document.Condenser;
import net.yacy.kelondro.data.meta.DigestURI;
import net.yacy.kelondro.data.meta.URIMetadataRow;
@@ -52,6 +53,7 @@ import net.yacy.kelondro.rwi.Reference;
import net.yacy.kelondro.rwi.ReferenceContainer;
import net.yacy.kelondro.rwi.ReferenceContainerCache;
import net.yacy.kelondro.util.FileUtils;
+import net.yacy.kelondro.util.ByteBuffer;
import net.yacy.repository.Blacklist;
import de.anomic.crawler.CrawlProfile;
@@ -120,7 +122,7 @@ public class IndexControlRWIs_p {
final String keystring = post.get("keystring", "").trim();
byte[] keyhash = post.get("keyhash", "").trim().getBytes();
prop.putHTML("keystring", keystring);
- prop.putHTML("keyhash", UTF8.String(keyhash));
+ prop.putHTML("keyhash", ASCII.String(keyhash));
// read values from checkboxes
String[] urls = post.getAll("urlhx.*");
@@ -140,13 +142,13 @@ public class IndexControlRWIs_p {
}
if (post.containsKey("keyhashsearch")) {
- if (keystring.length() == 0 || !UTF8.String(Word.word2hash(keystring)).equals(UTF8.String(keyhash))) {
+ if (keystring.length() == 0 || !ByteBuffer.equals(Word.word2hash(keystring), keyhash)) {
prop.put("keystring", "&lt;not possible to compute word from hash&gt;");
}
final RankingProcess ranking = genSearchresult(prop, sb, segment, keyhash, null);
if (ranking.filteredCount() == 0) {
prop.put("searchresult", 2);
- prop.putHTML("searchresult_wordhash", UTF8.String(keyhash));
+ prop.putHTML("searchresult_wordhash", ASCII.String(keyhash));
}
}
@@ -223,7 +225,7 @@ public class IndexControlRWIs_p {
}
if (post.containsKey("urllist")) {
- if (keystring.length() == 0 || !UTF8.String(Word.word2hash(keystring)).equals(UTF8.String(keyhash))) {
+ if (keystring.length() == 0 || !ByteBuffer.equals(Word.word2hash(keystring), keyhash)) {
prop.put("keystring", "&lt;not possible to compute word from hash&gt;");
}
final Bitfield flags = compileFlags(post);
@@ -234,7 +236,7 @@ public class IndexControlRWIs_p {
// transfer to other peer
if (post.containsKey("keyhashtransfer")) try {
- if (keystring.length() == 0 || !UTF8.String(Word.word2hash(keystring)).equals(UTF8.String(keyhash))) {
+ if (keystring.length() == 0 || !ByteBuffer.equals(Word.word2hash(keystring), keyhash)) {
prop.put("keystring", "&lt;not possible to compute word from hash&gt;");
}
@@ -412,7 +414,7 @@ public class IndexControlRWIs_p {
public static void genURLList(final serverObjects prop, final byte[] keyhash, final String keystring, final RankingProcess ranked, final Bitfield flags, final int maxlines) {
// search for a word hash and generate a list of url links
- prop.put("genUrlList_keyHash", UTF8.String(keyhash));
+ prop.put("genUrlList_keyHash", ASCII.String(keyhash));
if (ranked.filteredCount() == 0) {
prop.put("genUrlList", 1);
@@ -438,7 +440,7 @@ public class IndexControlRWIs_p {
prop.put("genUrlList_urlList_"+i+"_urlExists_urlhxCount", i);
prop.putHTML("genUrlList_urlList_"+i+"_urlExists_urlhxValue", entry.word().urlhash());
prop.putHTML("genUrlList_urlList_"+i+"_urlExists_keyString", keystring);
- prop.put("genUrlList_urlList_"+i+"_urlExists_keyHash", UTF8.String(keyhash));
+ prop.put("genUrlList_urlList_"+i+"_urlExists_keyHash", ASCII.String(keyhash));
prop.putHTML("genUrlList_urlList_"+i+"_urlExists_urlString", us);
prop.put("genUrlList_urlList_"+i+"_urlExists_urlStringShort", (us.length() > 40) ? (us.substring(0, 20) + "<br>" + us.substring(20, 40) + "...") : ((us.length() > 30) ? (us.substring(0, 20) + "<br>" + us.substring(20)) : us));
prop.putNum("genUrlList_urlList_"+i+"_urlExists_ranking", (entry.ranking() - rn));
@@ -542,7 +544,7 @@ public class IndexControlRWIs_p {
}
public static RankingProcess genSearchresult(final serverObjects prop, final Switchboard sb, Segment segment, final byte[] keyhash, final Bitfield filter) {
- final QueryParams query = new QueryParams(UTF8.String(keyhash), -1, filter, segment, sb.getRanking(), "IndexControlRWIs_p");
+ final QueryParams query = new QueryParams(ASCII.String(keyhash), -1, filter, segment, sb.getRanking(), "IndexControlRWIs_p");
final ReferenceOrder order = new ReferenceOrder(query.ranking, UTF8.getBytes(query.targetlang));
final RankingProcess ranked = new RankingProcess(query, order, Integer.MAX_VALUE);
ranked.run();
diff --git a/htroot/IndexControlURLs_p.java b/htroot/IndexControlURLs_p.java
index 74e002fd4..36a3450a2 100644
--- a/htroot/IndexControlURLs_p.java
+++ b/htroot/IndexControlURLs_p.java
@@ -31,7 +31,7 @@ import java.net.MalformedURLException;
import java.util.Iterator;
import net.yacy.cora.date.GenericFormatter;
-import net.yacy.cora.document.UTF8;
+import net.yacy.cora.document.ASCII;
import net.yacy.cora.protocol.RequestHeader;
import net.yacy.kelondro.data.meta.DigestURI;
import net.yacy.kelondro.data.meta.URIMetadataRow;
@@ -148,7 +148,7 @@ public class IndexControlURLs_p {
}
if (post.containsKey("urlhashdelete")) {
- final URIMetadataRow entry = segment.urlMetadata().load(UTF8.getBytes(urlhash));
+ final URIMetadataRow entry = segment.urlMetadata().load(ASCII.getBytes(urlhash));
if (entry == null) {
prop.putHTML("result", "No Entry for URL hash " + urlhash + "; nothing deleted.");
} else {
@@ -163,7 +163,7 @@ public class IndexControlURLs_p {
if (post.containsKey("urldelete")) {
try {
- urlhash = UTF8.String((new DigestURI(urlstring)).hash());
+ urlhash = ASCII.String((new DigestURI(urlstring)).hash());
} catch (final MalformedURLException e) {
urlhash = null;
}
@@ -180,9 +180,9 @@ public class IndexControlURLs_p {
if (post.containsKey("urlstringsearch")) {
try {
final DigestURI url = new DigestURI(urlstring);
- urlhash = UTF8.String(url.hash());
+ urlhash = ASCII.String(url.hash());
prop.put("urlhash", urlhash);
- final URIMetadataRow entry = segment.urlMetadata().load(UTF8.getBytes(urlhash));
+ final URIMetadataRow entry = segment.urlMetadata().load(ASCII.getBytes(urlhash));
if (entry == null) {
prop.putHTML("result", "No Entry for URL " + url.toNormalform(true, true));
prop.putHTML("urlstring", urlstring);
@@ -200,7 +200,7 @@ public class IndexControlURLs_p {
}
if (post.containsKey("urlhashsearch")) {
- final URIMetadataRow entry = segment.urlMetadata().load(UTF8.getBytes(urlhash));
+ final URIMetadataRow entry = segment.urlMetadata().load(ASCII.getBytes(urlhash));
if (entry == null) {
prop.putHTML("result", "No Entry for URL hash " + urlhash);
} else {
@@ -215,7 +215,7 @@ public class IndexControlURLs_p {
// generate list
if (post.containsKey("urlhashsimilar")) {
try {
- final Iterator<URIMetadataRow> entryIt = new RotateIterator<URIMetadataRow>(segment.urlMetadata().entries(true, urlhash), UTF8.String(Base64Order.zero((urlhash == null ? 0 : urlhash.length()))), segment.termIndex().sizesMax());
+ final Iterator<URIMetadataRow> entryIt = new RotateIterator<URIMetadataRow>(segment.urlMetadata().entries(true, urlhash), ASCII.String(Base64Order.zero((urlhash == null ? 0 : urlhash.length()))), segment.termIndex().sizesMax());
final StringBuilder result = new StringBuilder("Sequential List of URL-Hashes:<br />");
URIMetadataRow entry;
i = 0;
@@ -224,7 +224,7 @@ public class IndexControlURLs_p {
while (entryIt.hasNext() && i < 256) {
entry = entryIt.next();
if (entry == null) break;
- prop.put("urlhashsimilar_rows_"+rows+"_cols_"+cols+"_urlHash", UTF8.String(entry.hash()));
+ prop.put("urlhashsimilar_rows_"+rows+"_cols_"+cols+"_urlHash", ASCII.String(entry.hash()));
cols++;
if (cols==8) {
prop.put("urlhashsimilar_rows_"+rows+"_cols", cols);
@@ -342,7 +342,7 @@ public class IndexControlURLs_p {
prop.put("genUrlProfile_loaddate", entry.loaddate().toString());
prop.put("genUrlProfile_referrer", (le == null) ? 0 : 1);
prop.putHTML("genUrlProfile_referrer_url", (le == null) ? "<unknown>" : le.metadata().url().toNormalform(false, true));
- prop.put("genUrlProfile_referrer_hash", (le == null) ? "" : UTF8.String(le.hash()));
+ prop.put("genUrlProfile_referrer_hash", (le == null) ? "" : ASCII.String(le.hash()));
prop.put("genUrlProfile_doctype", String.valueOf(entry.doctype()));
prop.put("genUrlProfile_language", entry.language());
prop.put("genUrlProfile_size", entry.size());
diff --git a/htroot/IndexCreateLoaderQueue_p.java b/htroot/IndexCreateLoaderQueue_p.java
index 57651f06d..4adb7d823 100644
--- a/htroot/IndexCreateLoaderQueue_p.java
+++ b/htroot/IndexCreateLoaderQueue_p.java
@@ -27,7 +27,7 @@
// javac -classpath .:../classes IndexCreate_p.java
// if the shell's current path is HTROOT
-import net.yacy.cora.document.UTF8;
+import net.yacy.cora.document.ASCII;
import net.yacy.cora.protocol.RequestHeader;
import de.anomic.crawler.retrieval.Request;
import de.anomic.search.Switchboard;
@@ -54,7 +54,7 @@ public class IndexCreateLoaderQueue_p {
for (int i = 0; i < w.length; i++) {
if (w[i] == null) continue;
- initiator = sb.peers.getConnected((w[i].initiator() == null) ? "" : UTF8.String(w[i].initiator()));
+ initiator = sb.peers.getConnected((w[i].initiator() == null) ? "" : ASCII.String(w[i].initiator()));
prop.put("loader-set_list_"+count+"_dark", dark ? "1" : "0");
prop.putHTML("loader-set_list_"+count+"_initiator", ((initiator == null) ? "proxy" : initiator.getName()));
prop.put("loader-set_list_"+count+"_depth", w[i].depth());
diff --git a/htroot/IndexCreateParserErrors_p.java b/htroot/IndexCreateParserErrors_p.java
index a11adb399..9694a56d8 100644
--- a/htroot/IndexCreateParserErrors_p.java
+++ b/htroot/IndexCreateParserErrors_p.java
@@ -25,7 +25,7 @@
import java.util.ArrayList;
-import net.yacy.cora.document.UTF8;
+import net.yacy.cora.document.ASCII;
import net.yacy.cora.protocol.RequestHeader;
import net.yacy.kelondro.data.meta.DigestURI;
import de.anomic.crawler.ZURL;
@@ -84,8 +84,8 @@ public class IndexCreateParserErrors_p {
initiatorHash = entry.initiator();
executorHash = entry.executor();
- initiatorSeed = (initiatorHash == null) ? null : sb.peers.getConnected(UTF8.String(initiatorHash));
- executorSeed = (executorHash == null) ? null : sb.peers.getConnected(UTF8.String(executorHash));
+ initiatorSeed = (initiatorHash == null) ? null : sb.peers.getConnected(ASCII.String(initiatorHash));
+ executorSeed = (executorHash == null) ? null : sb.peers.getConnected(ASCII.String(executorHash));
prop.putHTML("rejected_list_"+j+"_initiator", ((initiatorSeed == null) ? "proxy" : initiatorSeed.getName()));
prop.putHTML("rejected_list_"+j+"_executor", ((executorSeed == null) ? "proxy" : executorSeed.getName()));
prop.putHTML("rejected_list_"+j+"_url", url.toNormalform(false, true));
diff --git a/htroot/IndexCreateWWWGlobalQueue_p.java b/htroot/IndexCreateWWWGlobalQueue_p.java
index b3dea65b5..eb9a18703 100644
--- a/htroot/IndexCreateWWWGlobalQueue_p.java
+++ b/htroot/IndexCreateWWWGlobalQueue_p.java
@@ -32,7 +32,7 @@ import java.util.Date;
import java.util.List;
import java.util.Locale;
-import net.yacy.cora.document.UTF8;
+import net.yacy.cora.document.ASCII;
import net.yacy.cora.protocol.RequestHeader;
import de.anomic.crawler.CrawlProfile;
@@ -97,7 +97,7 @@ public class IndexCreateWWWGlobalQueue_p {
for (i = 0; (i < crawlerList.size()) && (showNum < showLimit); i++) {
urle = crawlerList.get(i);
if (urle != null && urle.url() != null) {
- initiator = sb.peers.getConnected((urle.initiator() == null) ? "" : UTF8.String(urle.initiator()));
+ initiator = sb.peers.getConnected((urle.initiator() == null) ? "" : ASCII.String(urle.initiator()));
profileHandle = urle.profileHandle();
profileEntry = profileHandle == null ? null : sb.crawler.getActive(profileHandle.getBytes());
prop.put("crawler-queue_list_"+showNum+"_dark", dark ? "1" : "0");
diff --git a/htroot/IndexCreateWWWLocalQueue_p.java b/htroot/IndexCreateWWWLocalQueue_p.java
index 445c428d5..7e5f5b8f2 100644
--- a/htroot/IndexCreateWWWLocalQueue_p.java
+++ b/htroot/IndexCreateWWWLocalQueue_p.java
@@ -36,7 +36,7 @@ import java.util.Locale;
import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException;
-import net.yacy.cora.document.UTF8;
+import net.yacy.cora.document.ASCII;
import net.yacy.cora.protocol.RequestHeader;
import net.yacy.kelondro.logging.Log;
@@ -119,7 +119,7 @@ public class IndexCreateWWWLocalQueue_p {
case ANCHOR: value = entry.name(); break location;
case DEPTH: value = Integer.toString(entry.depth()); break location;
case INITIATOR:
- value = (entry.initiator() == null || entry.initiator().length == 0) ? "proxy" : UTF8.String(entry.initiator());
+ value = (entry.initiator() == null || entry.initiator().length == 0) ? "proxy" : ASCII.String(entry.initiator());
break location;
case MODIFIED: value = daydate(entry.appdate()); break location;
default: value = null; break location;
@@ -163,7 +163,7 @@ public class IndexCreateWWWLocalQueue_p {
for (i = 0; (i < crawlerList.size()) && (showNum < showLimit); i++) {
urle = crawlerList.get(i);
if ((urle != null)&&(urle.url()!=null)) {
- initiator = sb.peers.getConnected(urle.initiator() == null ? "" : UTF8.String(urle.initiator()));
+ initiator = sb.peers.getConnected(urle.initiator() == null ? "" : ASCII.String(urle.initiator()));
profileHandle = urle.profileHandle();
profileEntry = profileHandle == null ? null : sb.crawler.getActive(profileHandle.getBytes());
prop.put("crawler-queue_list_"+showNum+"_dark", dark ? "1" : "0");
diff --git a/htroot/IndexCreateWWWRemoteQueue_p.java b/htroot/IndexCreateWWWRemoteQueue_p.java
index c4b81ccdf..5b79f7863 100644
--- a/htroot/IndexCreateWWWRemoteQueue_p.java
+++ b/htroot/IndexCreateWWWRemoteQueue_p.java
@@ -29,7 +29,7 @@ import java.util.Date;
import java.util.List;
import java.util.Locale;
-import net.yacy.cora.document.UTF8;
+import net.yacy.cora.document.ASCII;
import net.yacy.cora.protocol.RequestHeader;
import de.anomic.crawler.CrawlProfile;
@@ -94,7 +94,7 @@ public class IndexCreateWWWRemoteQueue_p {
for (i = 0; (i < crawlerList.size()) && (showNum < showLimit); i++) {
urle = crawlerList.get(i);
if (urle != null && urle.url() != null) {
- initiator = sb.peers.getConnected((urle.initiator() == null) ? "" : UTF8.String(urle.initiator()));
+ initiator = sb.peers.getConnected((urle.initiator() == null) ? "" : ASCII.String(urle.initiator()));
profileHandle = urle.profileHandle();
profileEntry = profileHandle == null ? null : sb.crawler.getActive(profileHandle.getBytes());
prop.put("crawler-queue_list_" + showNum + "_dark", dark ? "1" : "0");
diff --git a/htroot/Supporter.java b/htroot/Supporter.java
index 9409dcf43..82ce77acd 100644
--- a/htroot/Supporter.java
+++ b/htroot/Supporter.java
@@ -31,6 +31,7 @@ import java.util.HashMap;
import java.util.Iterator;
import net.yacy.cora.date.GenericFormatter;
+import net.yacy.cora.document.ASCII;
import net.yacy.cora.document.UTF8;
import net.yacy.cora.protocol.RequestHeader;
import net.yacy.cora.storage.ConcurrentScoreMap;
@@ -245,13 +246,13 @@ public class Supporter {
// add/subtract votes and write record
if (entry != null) {
try {
- urlhash = UTF8.String((new DigestURI(url)).hash());
+ urlhash = ASCII.String((new DigestURI(url)).hash());
} catch (final MalformedURLException e) {
urlhash = null;
}
if (urlhash == null)
try {
- urlhash = UTF8.String((new DigestURI("http://" + url)).hash());
+ urlhash = ASCII.String((new DigestURI("http://" + url)).hash());
} catch (final MalformedURLException e) {
urlhash = null;
}
diff --git a/htroot/ViewFile.java b/htroot/ViewFile.java
index b0dcb29f1..f28a80c38 100644
--- a/htroot/ViewFile.java
+++ b/htroot/ViewFile.java
@@ -37,6 +37,7 @@ import java.util.Enumeration;
import java.util.Iterator;
import java.util.Map;
+import net.yacy.cora.document.ASCII;
import net.yacy.cora.document.MultiProtocolURI;
import net.yacy.cora.document.UTF8;
import net.yacy.cora.protocol.RequestHeader;
@@ -122,7 +123,7 @@ public class ViewFile {
String urlHash = post.get("urlHash", "");
URIMetadataRow urlEntry = null;
// get the urlEntry that belongs to the url hash
- if (urlHash.length() > 0 && (urlEntry = indexSegment.urlMetadata().load(UTF8.getBytes(urlHash))) != null) {
+ if (urlHash.length() > 0 && (urlEntry = indexSegment.urlMetadata().load(ASCII.getBytes(urlHash))) != null) {
// get the url that belongs to the entry
final URIMetadataRow.Components metadata = urlEntry.metadata();
if ((metadata == null) || (metadata.url() == null)) {
@@ -153,7 +154,7 @@ public class ViewFile {
// define an url by post parameter
url = new DigestURI(MultiProtocolURI.unescape(urlString));
- urlHash = UTF8.String(url.hash());
+ urlHash = ASCII.String(url.hash());
pre = post.getBoolean("pre", false);
} catch (final MalformedURLException e) {}
diff --git a/htroot/WebStructurePicture_p.java b/htroot/WebStructurePicture_p.java
index b40c2d887..b5f9113ac 100644
--- a/htroot/WebStructurePicture_p.java
+++ b/htroot/WebStructurePicture_p.java
@@ -32,7 +32,7 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
-import net.yacy.cora.document.UTF8;
+import net.yacy.cora.document.ASCII;
import net.yacy.cora.protocol.RequestHeader;
import net.yacy.kelondro.data.meta.DigestURI;
import net.yacy.kelondro.logging.Log;
@@ -106,7 +106,7 @@ public class WebStructurePicture_p {
// find start hash
String hash = null;
if (host != null && host.length() > 0) try {
- hash = UTF8.String((new DigestURI("http://" + host)).hash(), 6, 6);
+ hash = ASCII.String((new DigestURI("http://" + host)).hash(), 6, 6);
} catch (final MalformedURLException e) {Log.logException(e);}
//assert (sb.webStructure.outgoingReferences(hash) != null);
diff --git a/htroot/Wiki.java b/htroot/Wiki.java
index ece9db177..24bb64857 100644
--- a/htroot/Wiki.java
+++ b/htroot/Wiki.java
@@ -40,6 +40,7 @@ import java.util.Locale;
import net.yacy.cora.document.UTF8;
import net.yacy.cora.protocol.HeaderFramework;
import net.yacy.cora.protocol.RequestHeader;
+import net.yacy.kelondro.util.ByteBuffer;
import de.anomic.data.Diff;
import de.anomic.data.wiki.WikiBoard;
@@ -118,7 +119,7 @@ public class Wiki {
final Map<String, String> map = new HashMap<String, String>();
map.put("page", pagename);
map.put("author", author.replace(',', ' '));
- if (!sb.isRobinsonMode() && post.get("content", "").trim().length() > 0 && !UTF8.String(page.page()).equals(UTF8.String(content))) {
+ if (!sb.isRobinsonMode() && post.get("content", "").trim().length() > 0 && !ByteBuffer.equals(page.page(), content)) {
sb.peers.newsPool.publishMyNews(sb.peers.mySeed(), yacyNewsPool.CATEGORY_WIKI_UPDATE, map);
}
page = newEntry;
diff --git a/htroot/api/bookmarks/posts/delete_p.java b/htroot/api/bookmarks/posts/delete_p.java
index 1b32ef1dd..8adcb20a0 100755
--- a/htroot/api/bookmarks/posts/delete_p.java
+++ b/htroot/api/bookmarks/posts/delete_p.java
@@ -1,7 +1,7 @@
import java.net.MalformedURLException;
-import net.yacy.cora.document.UTF8;
+import net.yacy.cora.document.ASCII;
import net.yacy.cora.protocol.RequestHeader;
import net.yacy.kelondro.data.meta.DigestURI;
@@ -24,7 +24,7 @@ public class delete_p {
return prop;
}
try {
- if (post.containsKey("url") && switchboard.bookmarksDB.removeBookmark(UTF8.String((new DigestURI(post.get("url", "nourl"))).hash()))) {
+ if (post.containsKey("url") && switchboard.bookmarksDB.removeBookmark(ASCII.String((new DigestURI(post.get("url", "nourl"))).hash()))) {
prop.put("result", "1");
} else if (post.containsKey("urlhash") && switchboard.bookmarksDB.removeBookmark(post.get("urlhash", "nohash"))) {
prop.put("result", "1");
diff --git a/htroot/api/queues_p.java b/htroot/api/queues_p.java
index 1dc002aa8..6d1116fa5 100755
--- a/htroot/api/queues_p.java
+++ b/htroot/api/queues_p.java
@@ -3,6 +3,7 @@ import java.util.Date;
import java.util.List;
import java.util.Locale;
+import net.yacy.cora.document.ASCII;
import net.yacy.cora.document.UTF8;
import net.yacy.cora.protocol.RequestHeader;
@@ -59,7 +60,7 @@ public class queues_p {
for (final Request r : w) {
if (r == null) continue;
prop.put("list-loader_"+count+"_profile", r.profileHandle());
- initiator = sb.peers.getConnected((r.initiator() == null) ? "" : UTF8.String(r.initiator()));
+ initiator = sb.peers.getConnected((r.initiator() == null) ? "" : ASCII.String(r.initiator()));
prop.putHTML("list-loader_"+count+"_initiator", ((initiator == null) ? "proxy" : initiator.getName()));
prop.put("list-loader_"+count+"_depth", r.depth());
prop.putXML("list-loader_"+count+"_url", r.url().toString());
diff --git a/htroot/api/webstructure.java b/htroot/api/webstructure.java
index 428575ea4..6f36ab6c1 100644
--- a/htroot/api/webstructure.java
+++ b/htroot/api/webstructure.java
@@ -26,7 +26,7 @@ import java.net.MalformedURLException;
import java.util.Iterator;
import java.util.Map;
-import net.yacy.cora.document.UTF8;
+import net.yacy.cora.document.ASCII;
import net.yacy.cora.protocol.RequestHeader;
import net.yacy.kelondro.data.meta.DigestURI;
@@ -48,7 +48,7 @@ public class webstructure {
if (about.length() > 6) {
try {
url = new DigestURI(about);
- about = UTF8.String(url.hash(), 6, 6);
+ about = ASCII.String(url.hash(), 6, 6);
} catch (MalformedURLException e) {
about = null;
}
diff --git a/htroot/api/yacydoc.java b/htroot/api/yacydoc.java
index eab3a0586..de07ec0ab 100644
--- a/htroot/api/yacydoc.java
+++ b/htroot/api/yacydoc.java
@@ -28,6 +28,7 @@
import java.net.MalformedURLException;
import net.yacy.cora.date.ISO8601Formatter;
+import net.yacy.cora.document.ASCII;
import net.yacy.cora.document.UTF8;
import net.yacy.cora.protocol.RequestHeader;
import net.yacy.kelondro.data.meta.DigestURI;
@@ -78,7 +79,7 @@ public class yacydoc {
if (urlstring.length() > 0 && urlhash.length() == 0) {
try {
DigestURI url = new DigestURI(urlstring);
- urlhash = UTF8.String(url.hash());
+ urlhash = ASCII.String(url.hash());
} catch (MalformedURLException e) {
Log.logException(e);
}
@@ -109,7 +110,7 @@ public class yacydoc {
prop.put("yacy_urlhash", metadata.url().hash());
prop.putXML("yacy_loaddate", entry.loaddate().toString());
- prop.putXML("yacy_referrer_hash", (le == null) ? "" : UTF8.String(le.hash()));
+ prop.putXML("yacy_referrer_hash", (le == null) ? "" : ASCII.String(le.hash()));
prop.putXML("yacy_referrer_url", (le == null) ? "" : le.metadata().url().toNormalform(false, true));
prop.put("yacy_size", entry.size());
prop.put("yacy_words",entry.wordCount());
diff --git a/htroot/yacy/crawlReceipt.java b/htroot/yacy/crawlReceipt.java
index 131f8f1be..a480f96b1 100644
--- a/htroot/yacy/crawlReceipt.java
+++ b/htroot/yacy/crawlReceipt.java
@@ -29,7 +29,7 @@
import java.io.IOException;
-import net.yacy.cora.document.UTF8;
+import net.yacy.cora.document.ASCII;
import net.yacy.cora.protocol.RequestHeader;
import net.yacy.kelondro.data.meta.URIMetadataRow;
import net.yacy.kelondro.logging.Log;
@@ -128,7 +128,7 @@ public final class crawlReceipt {
final URIMetadataRow.Components metadata = entry.metadata();
if (metadata.url() == null) {
- if (log.isWarning()) log.logWarning("crawlReceipt: RECEIVED wrong RECEIPT (url null) for hash " + UTF8.String(entry.hash()) + " from peer " + iam + "\n\tURL properties: "+ propStr);
+ if (log.isWarning()) log.logWarning("crawlReceipt: RECEIVED wrong RECEIPT (url null) for hash " + ASCII.String(entry.hash()) + " from peer " + iam + "\n\tURL properties: "+ propStr);
prop.put("delay", "3600");
return prop;
}
@@ -136,7 +136,7 @@ public final class crawlReceipt {
// check if the entry is in our network domain
final String urlRejectReason = sb.crawlStacker.urlInAcceptedDomain(metadata.url());
if (urlRejectReason != null) {
- if (log.isWarning()) log.logWarning("crawlReceipt: RECEIVED wrong RECEIPT (" + urlRejectReason + ") for hash " + UTF8.String(entry.hash()) + " from peer " + iam + "\n\tURL properties: "+ propStr);
+ if (log.isWarning()) log.logWarning("crawlReceipt: RECEIVED wrong RECEIPT (" + urlRejectReason + ") for hash " + ASCII.String(entry.hash()) + " from peer " + iam + "\n\tURL properties: "+ propStr);
prop.put("delay", "9999");
return prop;
}
@@ -146,7 +146,7 @@ public final class crawlReceipt {
sb.indexSegments.urlMetadata(Segments.Process.RECEIPTS).store(entry);
ResultURLs.stack(entry, youare.getBytes(), iam.getBytes(), EventOrigin.REMOTE_RECEIPTS);
sb.crawlQueues.delegatedURL.remove(entry.hash()); // the delegated work has been done
- if (log.isInfo()) log.logInfo("crawlReceipt: RECEIVED RECEIPT from " + otherPeerName + " for URL " + UTF8.String(entry.hash()) + ":" + metadata.url().toNormalform(false, true));
+ if (log.isInfo()) log.logInfo("crawlReceipt: RECEIVED RECEIPT from " + otherPeerName + " for URL " + ASCII.String(entry.hash()) + ":" + metadata.url().toNormalform(false, true));
// ready for more
prop.put("delay", "10");
diff --git a/htroot/yacy/idx.java b/htroot/yacy/idx.java
index 42813617f..4e484b364 100644
--- a/htroot/yacy/idx.java
+++ b/htroot/yacy/idx.java
@@ -24,7 +24,7 @@
import java.util.Iterator;
-import net.yacy.cora.document.UTF8;
+import net.yacy.cora.document.ASCII;
import net.yacy.cora.protocol.RequestHeader;
import net.yacy.kelondro.rwi.ReferenceContainer;
import net.yacy.kelondro.rwi.ReferenceContainerCache;
@@ -61,7 +61,7 @@ public final class idx {
prop.put("rowdef", WebStructureGraph.hostReferenceFactory.getRow().toString());
int count = 0;
for (ReferenceContainer<HostReference> references: idx) {
- prop.put("list_" + count + "_term", UTF8.String(references.getTermHash()));
+ prop.put("list_" + count + "_term", ASCII.String(references.getTermHash()));
Iterator<HostReference> referenceIterator = references.entries();
StringBuilder s = new StringBuilder();
HostReference reference;
diff --git a/htroot/yacy/search.java b/htroot/yacy/search.java
index 4b252f5f1..d73651960 100644
--- a/htroot/yacy/search.java
+++ b/htroot/yacy/search.java
@@ -36,6 +36,7 @@ import java.util.TreeMap;
import java.util.TreeSet;
import java.util.regex.Pattern;
+import net.yacy.cora.document.ASCII;
import net.yacy.cora.document.RSSMessage;
import net.yacy.cora.document.UTF8;
import net.yacy.cora.protocol.Domains;
@@ -50,6 +51,7 @@ import net.yacy.kelondro.data.word.WordReferenceRow;
import net.yacy.kelondro.index.HandleSet;
import net.yacy.kelondro.order.Bitfield;
import net.yacy.kelondro.rwi.ReferenceContainer;
+import net.yacy.kelondro.util.ByteBuffer;
import net.yacy.kelondro.util.EventTracker;
import net.yacy.kelondro.util.ISO639;
import net.yacy.kelondro.util.MemoryControl;
@@ -260,7 +262,7 @@ public final class search {
final ReferenceContainer<WordReference> container = entry.getValue();
indexabstractContainercount += container.size();
indexabstract.append("indexabstract.");
- indexabstract.append(UTF8.String(wordhash));
+ indexabstract.append(ASCII.String(wordhash));
indexabstract.append("=");
indexabstract.append(WordReferenceFactory.compressIndex(container, null, 1000).toString());
indexabstract.append(serverCore.CRLF_STRING);
@@ -333,7 +335,7 @@ public final class search {
while (j.hasNext()) {
wordhash = j.next();
indexabstractContainercount += theSearch.abstractsCount(wordhash);
- indexabstract.append("indexabstract.").append(UTF8.String(wordhash)).append("=").append(theSearch.abstractsString(wordhash)).append(serverCore.CRLF_STRING);
+ indexabstract.append("indexabstract.").append(ASCII.String(wordhash)).append("=").append(theSearch.abstractsString(wordhash)).append(serverCore.CRLF_STRING);
}
}
prop.put("indexcount", indexcount.toString());
@@ -346,11 +348,11 @@ public final class search {
} else if (abstracts.equals("auto")) {
// automatically attach the index abstract for the index that has the most references. This should be our target dht position
indexabstractContainercount += theSearch.abstractsCount(theSearch.getAbstractsMaxCountHash());
- indexabstract.append("indexabstract.").append(UTF8.String(theSearch.getAbstractsMaxCountHash())).append("=").append(theSearch.abstractsString(theSearch.getAbstractsMaxCountHash())).append(serverCore.CRLF_STRING);
- if ((theSearch.getAbstractsNearDHTHash() != null) && (!(UTF8.String(theSearch.getAbstractsNearDHTHash()).equals(UTF8.String(theSearch.getAbstractsMaxCountHash()))))) {
+ indexabstract.append("indexabstract.").append(ASCII.String(theSearch.getAbstractsMaxCountHash())).append("=").append(theSearch.abstractsString(theSearch.getAbstractsMaxCountHash())).append(serverCore.CRLF_STRING);
+ if ((theSearch.getAbstractsNearDHTHash() != null) && (!(ByteBuffer.equals(theSearch.getAbstractsNearDHTHash(), theSearch.getAbstractsMaxCountHash())))) {
// in case that the neardhthash is different from the maxcounthash attach also the neardhthash-container
indexabstractContainercount += theSearch.abstractsCount(theSearch.getAbstractsNearDHTHash());
- indexabstract.append("indexabstract.").append(UTF8.String(theSearch.getAbstractsNearDHTHash())).append("=").append(theSearch.abstractsString(theSearch.getAbstractsNearDHTHash())).append(serverCore.CRLF_STRING);
+ indexabstract.append("indexabstract.").append(ASCII.String(theSearch.getAbstractsNearDHTHash())).append("=").append(theSearch.abstractsString(theSearch.getAbstractsNearDHTHash())).append(serverCore.CRLF_STRING);
}
//System.out.println("DEBUG-ABSTRACTGENERATION: maxcounthash = " + maxcounthash);
//System.out.println("DEBUG-ABSTRACTGENERATION: neardhthash = "+ neardhthash);
diff --git a/htroot/yacy/transferRWI.java b/htroot/yacy/transferRWI.java
index ac22bce74..154eade91 100644
--- a/htroot/yacy/transferRWI.java
+++ b/htroot/yacy/transferRWI.java
@@ -30,6 +30,7 @@
import java.util.ArrayList;
import java.util.Iterator;
+import net.yacy.cora.document.ASCII;
import net.yacy.cora.document.RSSMessage;
import net.yacy.cora.document.UTF8;
import net.yacy.cora.protocol.RequestHeader;
@@ -167,7 +168,7 @@ public final class transferRWI {
// block blacklisted entries
if ((blockBlacklist) && (Switchboard.urlBlacklist.hashInBlacklistedCache(Blacklist.BLACKLIST_DHT, urlHash))) {
- if (yacyCore.log.isFine()) yacyCore.log.logFine("transferRWI: blocked blacklisted URLHash '" + UTF8.String(urlHash) + "' from peer " + otherPeerName);
+ if (yacyCore.log.isFine()) yacyCore.log.logFine("transferRWI: blocked blacklisted URLHash '" + ASCII.String(urlHash) + "' from peer " + otherPeerName);
blocked++;
continue;
}
@@ -175,7 +176,7 @@ public final class transferRWI {
// check if the entry is in our network domain
final String urlRejectReason = sb.crawlStacker.urlInAcceptedDomainHash(urlHash);
if (urlRejectReason != null) {
- yacyCore.log.logWarning("transferRWI: blocked URL hash '" + UTF8.String(urlHash) + "' (" + urlRejectReason + ") from peer " + otherPeerName + "; peer is suspected to be a spam-peer (or something is wrong)");
+ yacyCore.log.logWarning("transferRWI: blocked URL hash '" + ASCII.String(urlHash) + "' (" + urlRejectReason + ") from peer " + otherPeerName + "; peer is suspected to be a spam-peer (or something is wrong)");
//if (yacyCore.log.isFine()) yacyCore.log.logFine("transferRWI: blocked URL hash '" + urlHash + "' (" + urlRejectReason + ") from peer " + otherPeerName);
blocked++;
continue;
@@ -200,7 +201,7 @@ public final class transferRWI {
} catch (final Exception ex) {
sb.getLog().logWarning(
"transferRWI: DB-Error while trying to determine if URL with hash '" +
- UTF8.String(urlHash) + "' is known.", ex);
+ ASCII.String(urlHash) + "' is known.", ex);
}
received++;
}
diff --git a/htroot/yacy/urls.java b/htroot/yacy/urls.java
index a0691c187..50c27d6b9 100644
--- a/htroot/yacy/urls.java
+++ b/htroot/yacy/urls.java
@@ -28,7 +28,7 @@ import java.io.IOException;
import java.util.Date;
import net.yacy.cora.date.GenericFormatter;
-import net.yacy.cora.document.UTF8;
+import net.yacy.cora.document.ASCII;
import net.yacy.cora.protocol.RequestHeader;
import net.yacy.kelondro.data.meta.DigestURI;
import net.yacy.kelondro.data.meta.URIMetadataRow;
@@ -115,7 +115,7 @@ public class urls {
URIMetadataRow.Components metadata;
DigestURI referrer;
for (int i = 0; i < count; i++) {
- entry = sb.indexSegments.urlMetadata(Segments.Process.PUBLIC).load(UTF8.getBytes(urlhashes.substring(12 * i, 12 * (i + 1))));
+ entry = sb.indexSegments.urlMetadata(Segments.Process.PUBLIC).load(ASCII.getBytes(urlhashes.substring(12 * i, 12 * (i + 1))));
if (entry == null) continue;
// find referrer, if there is one
referrer = sb.getURL(Segments.Process.PUBLIC, entry.referrerHash());
@@ -127,7 +127,7 @@ public class urls {
prop.putXML("item_" + c + "_description", metadata.dc_title());
prop.put("item_" + c + "_author", metadata.dc_creator());
prop.put("item_" + c + "_pubDate", GenericFormatter.SHORT_SECOND_FORMATTER.format(entry.moddate()));
- prop.put("item_" + c + "_guid", UTF8.String(entry.hash()));
+ prop.put("item_" + c + "_guid", ASCII.String(entry.hash()));
c++;
}
prop.put("item", c);
diff --git a/htroot/yacysearch.java b/htroot/yacysearch.java
index 3dcb6d8be..6e7bd6e38 100644
--- a/htroot/yacysearch.java
+++ b/htroot/yacysearch.java
@@ -36,6 +36,7 @@ import java.util.TreeSet;
import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException;
+import net.yacy.cora.document.ASCII;
import net.yacy.cora.document.RSSMessage;
import net.yacy.cora.document.UTF8;
import net.yacy.cora.protocol.Domains;
@@ -417,7 +418,7 @@ public class yacysearch {
author = querystring.substring(authori + 7, ftb);
querystring = querystring.replace("author:" + author, "");
}
- authorhash = UTF8.String(Word.word2hash(author));
+ authorhash = ASCII.String(Word.word2hash(author));
}
final int tld = querystring.indexOf("tld:");
if (tld >= 0) {
diff --git a/htroot/yacysearchitem.java b/htroot/yacysearchitem.java
index 50580a96e..201577e31 100644
--- a/htroot/yacysearchitem.java
+++ b/htroot/yacysearchitem.java
@@ -29,7 +29,7 @@ import java.util.List;
import java.util.Set;
import net.yacy.cora.date.GenericFormatter;
-import net.yacy.cora.document.UTF8;
+import net.yacy.cora.document.ASCII;
import net.yacy.cora.protocol.HeaderFramework;
import net.yacy.cora.protocol.RequestHeader;
import net.yacy.kelondro.data.meta.DigestURI;
@@ -129,10 +129,10 @@ public class yacysearchitem {
prop.put("content_showPictures", sb.getConfigBool("search.result.show.pictures", true) ? 1 : 0);
prop.put("content_authorized", authenticated ? "1" : "0");
prop.put("content_authorized_recommend", (sb.peers.newsPool.getSpecific(yacyNewsPool.OUTGOING_DB, yacyNewsPool.CATEGORY_SURFTIPP_ADD, "url", result.urlstring()) == null) ? "1" : "0");
- prop.putHTML("content_authorized_recommend_deletelink", "/yacysearch.html?query=" + theQuery.queryString.replace(' ', '+') + "&Enter=Search&count=" + theQuery.displayResults() + "&offset=" + (theQuery.neededResults() - theQuery.displayResults()) + "&order=" + crypt.simpleEncode(theQuery.ranking.toExternalString()) + "&resource=local&time=3&deleteref=" + UTF8.String(result.hash()) + "&urlmaskfilter=.*");
- prop.putHTML("content_authorized_recommend_recommendlink", "/yacysearch.html?query=" + theQuery.queryString.replace(' ', '+') + "&Enter=Search&count=" + theQuery.displayResults() + "&offset=" + (theQuery.neededResults() - theQuery.displayResults()) + "&order=" + crypt.simpleEncode(theQuery.ranking.toExternalString()) + "&resource=local&time=3&recommendref=" + UTF8.String(result.hash()) + "&urlmaskfilter=.*");
- prop.put("content_authorized_urlhash", UTF8.String(result.hash()));
- String resulthashString = UTF8.String(result.hash());
+ prop.putHTML("content_authorized_recommend_deletelink", "/yacysearch.html?query=" + theQuery.queryString.replace(' ', '+') + "&Enter=Search&count=" + theQuery.displayResults() + "&offset=" + (theQuery.neededResults() - theQuery.displayResults()) + "&order=" + crypt.simpleEncode(theQuery.ranking.toExternalString()) + "&resource=local&time=3&deleteref=" + ASCII.String(result.hash()) + "&urlmaskfilter=.*");
+ prop.putHTML("content_authorized_recommend_recommendlink", "/yacysearch.html?query=" + theQuery.queryString.replace(' ', '+') + "&Enter=Search&count=" + theQuery.displayResults() + "&offset=" + (theQuery.neededResults() - theQuery.displayResults()) + "&order=" + crypt.simpleEncode(theQuery.ranking.toExternalString()) + "&resource=local&time=3&recommendref=" + ASCII.String(result.hash()) + "&urlmaskfilter=.*");
+ prop.put("content_authorized_urlhash", ASCII.String(result.hash()));
+ String resulthashString = ASCII.String(result.hash());
prop.putHTML("content_title", result.title());
prop.putXML("content_title-xml", result.title());
prop.putJSON("content_title-json", result.title());
@@ -224,7 +224,7 @@ public class yacysearchitem {
prop.put("content_item_width", ms.width);
prop.put("content_item_height", ms.height);
prop.put("content_item_attr", (ms.attr.equals("-1 x -1")) ? "" : "(" + ms.attr + ")"); // attributes, here: original size of image
- prop.put("content_item_urlhash", UTF8.String(ms.source.hash()));
+ prop.put("content_item_urlhash", ASCII.String(ms.source.hash()));
prop.put("content_item_source", ms.source.toNormalform(true, false));
prop.putXML("content_item_source-xml", ms.source.toNormalform(true, false));
prop.put("content_item_sourcedom", ms.source.getHost());
diff --git a/source/de/anomic/crawler/Balancer.java b/source/de/anomic/crawler/Balancer.java
index 9b38d176a..28cebbdc5 100644
--- a/source/de/anomic/crawler/Balancer.java
+++ b/source/de/anomic/crawler/Balancer.java
@@ -38,6 +38,7 @@ import java.util.TreeMap;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentLinkedQueue;
+import net.yacy.cora.document.ASCII;
import net.yacy.cora.document.UTF8;
import net.yacy.kelondro.data.meta.URIMetadataRow;
import net.yacy.kelondro.index.BufferedObjectIndex;
@@ -281,8 +282,8 @@ public class Balancer {
// add to index
final int s = this.urlFileIndex.size();
this.urlFileIndex.put(entry.toRow());
- assert s < this.urlFileIndex.size() : "hash = " + UTF8.String(hash) + ", s = " + s + ", size = " + this.urlFileIndex.size();
- assert this.urlFileIndex.has(hash) : "hash = " + UTF8.String(hash);
+ assert s < this.urlFileIndex.size() : "hash = " + ASCII.String(hash) + ", s = " + s + ", size = " + this.urlFileIndex.size();
+ assert this.urlFileIndex.has(hash) : "hash = " + ASCII.String(hash);
// add the hash to a queue
pushHashToDomainStacks(entry.url().getHost(), entry.url().hash());
@@ -419,8 +420,8 @@ public class Balancer {
(profileEntry.cacheStrategy() == CrawlProfile.CacheStrategy.IFEXIST && Cache.has(crawlEntry.url()))
) ? 0 : Latency.waitingRemaining(crawlEntry.url(), myAgentIDs, minimumLocalDelta, minimumGlobalDelta); // this uses the robots.txt database and may cause a loading of robots.txt from the server
- assert Base64Order.enhancedCoder.equal(nexthash, rowEntry.getPrimaryKeyBytes()) : "result = " + UTF8.String(nexthash) + ", rowEntry.getPrimaryKeyBytes() = " + UTF8.String(rowEntry.getPrimaryKeyBytes());
- assert Base64Order.enhancedCoder.equal(nexthash, crawlEntry.url().hash()) : "result = " + UTF8.String(nexthash) + ", crawlEntry.url().hash() = " + UTF8.String(crawlEntry.url().hash());
+ assert Base64Order.enhancedCoder.equal(nexthash, rowEntry.getPrimaryKeyBytes()) : "result = " + ASCII.String(nexthash) + ", rowEntry.getPrimaryKeyBytes() = " + ASCII.String(rowEntry.getPrimaryKeyBytes());
+ assert Base64Order.enhancedCoder.equal(nexthash, crawlEntry.url().hash()) : "result = " + ASCII.String(nexthash) + ", crawlEntry.url().hash() = " + ASCII.String(crawlEntry.url().hash());
if (failhash != null && Base64Order.enhancedCoder.equal(failhash, nexthash)) break; // prevent endless loops
diff --git a/source/de/anomic/crawler/CrawlProfile.java b/source/de/anomic/crawler/CrawlProfile.java
index 32cee6472..35a93dc3f 100644
--- a/source/de/anomic/crawler/CrawlProfile.java
+++ b/source/de/anomic/crawler/CrawlProfile.java
@@ -26,7 +26,7 @@ import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.regex.Pattern;
-import net.yacy.cora.document.UTF8;
+import net.yacy.cora.document.ASCII;
import net.yacy.kelondro.data.meta.DigestURI;
import net.yacy.kelondro.data.word.Word;
import net.yacy.kelondro.logging.Log;
@@ -81,7 +81,7 @@ public class CrawlProfile extends ConcurrentHashMap<String, String> implements M
final CacheStrategy cacheStrategy) {
super(40);
if (name == null || name.length() == 0) throw new NullPointerException("name must not be null");
- final String handle = (startURL == null) ? Base64Order.enhancedCoder.encode(Digest.encodeMD5Raw(name)).substring(0, Word.commonHashLength) : UTF8.String(startURL.hash());
+ final String handle = (startURL == null) ? Base64Order.enhancedCoder.encode(Digest.encodeMD5Raw(name)).substring(0, Word.commonHashLength) : ASCII.String(startURL.hash());
put(HANDLE, handle);
put(NAME, name);
put(START_URL, (startURL == null) ? "" : startURL.toNormalform(true, false));
diff --git a/source/de/anomic/crawler/CrawlQueues.java b/source/de/anomic/crawler/CrawlQueues.java
index f465b21e3..49beff401 100644
--- a/source/de/anomic/crawler/CrawlQueues.java
+++ b/source/de/anomic/crawler/CrawlQueues.java
@@ -35,6 +35,7 @@ import java.util.Iterator;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
+import net.yacy.cora.document.ASCII;
import net.yacy.cora.document.Hit;
import net.yacy.cora.document.RSSFeed;
import net.yacy.cora.document.UTF8;
@@ -243,7 +244,7 @@ public class CrawlQueues {
log.logSevere(stats + ": NULL PROFILE HANDLE '" + urlEntry.profileHandle() + "' for URL " + urlEntry.url());
return true;
}
- CrawlProfile profile = sb.crawler.getActive(UTF8.getBytes(profileHandle));
+ CrawlProfile profile = sb.crawler.getActive(ASCII.getBytes(profileHandle));
if (profile == null) {
log.logSevere(stats + ": NULL PROFILE HANDLE '" + urlEntry.profileHandle() + "' for URL " + urlEntry.url());
return true;
@@ -294,7 +295,7 @@ public class CrawlQueues {
if (sb.loader.isSupportedProtocol(urlProtocol)) {
if (this.log.isFine())
log.logFine(stats + ": URL=" + urlEntry.url()
- + ", initiator=" + ((urlEntry.initiator() == null) ? "" : UTF8.String(urlEntry.initiator()))
+ + ", initiator=" + ((urlEntry.initiator() == null) ? "" : ASCII.String(urlEntry.initiator()))
+ ", crawlOrder=" + ((profile.remoteIndexing()) ? "true" : "false")
+ ", depth=" + urlEntry.depth()
+ ", crawlDepth=" + profile.depth()
@@ -468,7 +469,7 @@ public class CrawlQueues {
// stack url
if (sb.getLog().isFinest()) sb.getLog().logFinest("crawlOrder: stack: url='" + url + "'");
sb.crawlStacker.enqueueEntry(new Request(
- UTF8.getBytes(hash),
+ ASCII.getBytes(hash),
url,
(referrer == null) ? null : referrer.hash(),
item.getDescription(),
@@ -579,7 +580,7 @@ public class CrawlQueues {
//if (log.isFine()) log.logFine("Crawling of URL '" + request.url().toString() + "' disallowed by robots.txt.");
errorURL.push(
this.request,
- UTF8.getBytes(sb.peers.mySeed().hash),
+ ASCII.getBytes(sb.peers.mySeed().hash),
new Date(),
1,
FailCategory.FINAL_ROBOTS_RULE,
@@ -616,7 +617,7 @@ public class CrawlQueues {
if (result != null) {
errorURL.push(
this.request,
- UTF8.getBytes(sb.peers.mySeed().hash),
+ ASCII.getBytes(sb.peers.mySeed().hash),
new Date(),
1,
FailCategory.TEMPORARY_NETWORK_FAILURE,
@@ -629,7 +630,7 @@ public class CrawlQueues {
} catch (final Exception e) {
errorURL.push(
this.request,
- UTF8.getBytes(sb.peers.mySeed().hash),
+ ASCII.getBytes(sb.peers.mySeed().hash),
new Date(),
1,
FailCategory.TEMPORARY_NETWORK_FAILURE,
diff --git a/source/de/anomic/crawler/CrawlStacker.java b/source/de/anomic/crawler/CrawlStacker.java
index 8061cd476..dc0be6f31 100644
--- a/source/de/anomic/crawler/CrawlStacker.java
+++ b/source/de/anomic/crawler/CrawlStacker.java
@@ -39,6 +39,7 @@ import java.util.Properties;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.ConcurrentHashMap;
+import net.yacy.cora.document.ASCII;
import net.yacy.cora.document.MultiProtocolURI;
import net.yacy.cora.document.UTF8;
import net.yacy.cora.protocol.Domains;
@@ -203,7 +204,7 @@ public final class CrawlStacker {
// if the url was rejected we store it into the error URL db
if (rejectReason != null) {
- nextQueue.errorURL.push(entry, UTF8.getBytes(peers.mySeed().hash), new Date(), 1, FailCategory.FINAL_LOAD_CONTEXT, rejectReason, -1);
+ nextQueue.errorURL.push(entry, ASCII.getBytes(peers.mySeed().hash), new Date(), 1, FailCategory.FINAL_LOAD_CONTEXT, rejectReason, -1);
}
} catch (final Exception e) {
CrawlStacker.this.log.logWarning("Error while processing stackCrawl entry.\n" + "Entry: " + entry.toString() + "Error: " + e.toString(), e);
@@ -215,7 +216,7 @@ public final class CrawlStacker {
public void enqueueEntry(final Request entry) {
// DEBUG
- if (log.isFinest()) log.logFinest("ENQUEUE " + entry.url() + ", referer=" + entry.referrerhash() + ", initiator=" + ((entry.initiator() == null) ? "" : UTF8.String(entry.initiator())) + ", name=" + entry.name() + ", appdate=" + entry.appdate() + ", depth=" + entry.depth());
+ if (log.isFinest()) log.logFinest("ENQUEUE " + entry.url() + ", referer=" + entry.referrerhash() + ", initiator=" + ((entry.initiator() == null) ? "" : ASCII.String(entry.initiator())) + ", name=" + entry.name() + ", appdate=" + entry.appdate() + ", depth=" + entry.depth());
if (prefetchHost(entry.url().getHost())) {
try {
@@ -373,7 +374,7 @@ public final class CrawlStacker {
// store information
final boolean local = Base64Order.enhancedCoder.equal(entry.initiator(), UTF8.getBytes(peers.mySeed().hash));
- final boolean proxy = (entry.initiator() == null || entry.initiator().length == 0 || UTF8.String(entry.initiator()).equals("------------")) && profile.handle().equals(crawler.defaultProxyProfile.handle());
+ final boolean proxy = (entry.initiator() == null || entry.initiator().length == 0 || ASCII.String(entry.initiator()).equals("------------")) && profile.handle().equals(crawler.defaultProxyProfile.handle());
final boolean remote = profile.handle().equals(crawler.defaultRemoteProfile.handle());
final boolean global =
(profile.remoteIndexing()) /* granted */ &&
@@ -385,7 +386,7 @@ public final class CrawlStacker {
) /* qualified */;
if (!local && !global && !remote && !proxy) {
- error = "URL '" + entry.url().toString() + "' cannot be crawled. initiator = " + ((entry.initiator() == null) ? "" : UTF8.String(entry.initiator())) + ", profile.handle = " + profile.handle();
+ error = "URL '" + entry.url().toString() + "' cannot be crawled. initiator = " + ((entry.initiator() == null) ? "" : ASCII.String(entry.initiator())) + ", profile.handle = " + profile.handle();
this.log.logSevere(error);
return error;
}
@@ -418,14 +419,14 @@ public final class CrawlStacker {
if (global) {
// it may be possible that global == true and local == true, so do not check an error case against it
if (proxy) this.log.logWarning("URL '" + entry.url().toString() + "' has conflicting initiator properties: global = true, proxy = true, initiator = proxy" + ", profile.handle = " + profile.handle());
- if (remote) this.log.logWarning("URL '" + entry.url().toString() + "' has conflicting initiator properties: global = true, remote = true, initiator = " + UTF8.String(entry.initiator()) + ", profile.handle = " + profile.handle());
+ if (remote) this.log.logWarning("URL '" + entry.url().toString() + "' has conflicting initiator properties: global = true, remote = true, initiator = " + ASCII.String(entry.initiator()) + ", profile.handle = " + profile.handle());
warning = nextQueue.noticeURL.push(NoticedURL.StackType.LIMIT, entry);
} else if (local) {
if (proxy) this.log.logWarning("URL '" + entry.url().toString() + "' has conflicting initiator properties: local = true, proxy = true, initiator = proxy" + ", profile.handle = " + profile.handle());
- if (remote) this.log.logWarning("URL '" + entry.url().toString() + "' has conflicting initiator properties: local = true, remote = true, initiator = " + UTF8.String(entry.initiator()) + ", profile.handle = " + profile.handle());
+ if (remote) this.log.logWarning("URL '" + entry.url().toString() + "' has conflicting initiator properties: local = true, remote = true, initiator = " + ASCII.String(entry.initiator()) + ", profile.handle = " + profile.handle());
warning = nextQueue.noticeURL.push(NoticedURL.StackType.CORE, entry);
} else if (proxy) {
- if (remote) this.log.logWarning("URL '" + entry.url().toString() + "' has conflicting initiator properties: proxy = true, remote = true, initiator = " + UTF8.String(entry.initiator()) + ", profile.handle = " + profile.handle());
+ if (remote) this.log.logWarning("URL '" + entry.url().toString() + "' has conflicting initiator properties: proxy = true, remote = true, initiator = " + ASCII.String(entry.initiator()) + ", profile.handle = " + profile.handle());
warning = nextQueue.noticeURL.push(NoticedURL.StackType.CORE, entry);
} else if (remote) {
warning = nextQueue.noticeURL.push(NoticedURL.StackType.REMOTE, entry);
@@ -572,8 +573,8 @@ public final class CrawlStacker {
if (this.acceptLocalURLs && local) return null;
if (this.acceptGlobalURLs && !local) return null;
return (local) ?
- ("the urlhash '" + UTF8.String(urlhash) + "' is local, but local addresses are not accepted") :
- ("the urlhash '" + UTF8.String(urlhash) + "' is global, but global addresses are not accepted");
+ ("the urlhash '" + ASCII.String(urlhash) + "' is local, but local addresses are not accepted") :
+ ("the urlhash '" + ASCII.String(urlhash) + "' is global, but global addresses are not accepted");
}
public boolean acceptLocalURLs() {
diff --git a/source/de/anomic/crawler/ResultURLs.java b/source/de/anomic/crawler/ResultURLs.java
index ae6dc050c..f2d4864dd 100644
--- a/source/de/anomic/crawler/ResultURLs.java
+++ b/source/de/anomic/crawler/ResultURLs.java
@@ -32,6 +32,7 @@ import java.util.LinkedHashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
+import net.yacy.cora.document.ASCII;
import net.yacy.cora.document.UTF8;
import net.yacy.cora.storage.ClusteredScoreMap;
import net.yacy.cora.storage.ScoreMap;
@@ -105,7 +106,7 @@ public final class ResultURLs {
try {
final Map<String, InitExecEntry> resultStack = getStack(stackType);
if (resultStack != null) {
- resultStack.put(UTF8.String(e.hash()), new InitExecEntry(initiatorHash, executorHash));
+ resultStack.put(ASCII.String(e.hash()), new InitExecEntry(initiatorHash, executorHash));
}
} catch (final Exception ex) {
System.out.println("INTERNAL ERROR in newEntry/2: " + ex.toString());
diff --git a/source/de/anomic/crawler/RobotsTxtEntry.java b/source/de/anomic/crawler/RobotsTxtEntry.java
index c0e65be83..1b6636883 100644
--- a/source/de/anomic/crawler/RobotsTxtEntry.java
+++ b/source/de/anomic/crawler/RobotsTxtEntry.java
@@ -36,6 +36,7 @@ import java.util.LinkedList;
import java.util.List;
import java.util.Map;
+import net.yacy.cora.document.ASCII;
import net.yacy.cora.document.MultiProtocolURI;
import net.yacy.cora.document.UTF8;
import net.yacy.kelondro.util.ByteArray;
@@ -197,7 +198,7 @@ public class RobotsTxtEntry {
protected String getETag() {
if (this.mem.containsKey(ETAG)) {
- return UTF8.String(this.mem.get(ETAG));
+ return ASCII.String(this.mem.get(ETAG));
}
return null;
}
diff --git a/source/de/anomic/crawler/SitemapImporter.java b/source/de/anomic/crawler/SitemapImporter.java
index 384ab53e3..9d362b74b 100644
--- a/source/de/anomic/crawler/SitemapImporter.java
+++ b/source/de/anomic/crawler/SitemapImporter.java
@@ -28,7 +28,7 @@ package de.anomic.crawler;
import java.net.MalformedURLException;
import java.util.Date;
-import net.yacy.cora.document.UTF8;
+import net.yacy.cora.document.ASCII;
import net.yacy.document.parser.sitemapParser;
import net.yacy.kelondro.data.meta.DigestURI;
import net.yacy.kelondro.data.meta.URIMetadataRow;
@@ -90,7 +90,7 @@ public class SitemapImporter extends Thread {
// URL needs to crawled
this.sb.crawlStacker.enqueueEntry(new Request(
- UTF8.getBytes(this.sb.peers.mySeed().hash),
+ ASCII.getBytes(this.sb.peers.mySeed().hash),
url,
null, // this.siteMapURL.toString(),
entry.url(),
diff --git a/source/de/anomic/crawler/ZURL.java b/source/de/anomic/crawler/ZURL.java
index 09ce6fb89..adf24f5b8 100755
--- a/source/de/anomic/crawler/ZURL.java
+++ b/source/de/anomic/crawler/ZURL.java
@@ -33,6 +33,7 @@ import java.util.Date;
import java.util.Iterator;
import java.util.concurrent.ConcurrentLinkedQueue;
+import net.yacy.cora.document.ASCII;
import net.yacy.cora.document.UTF8;
import net.yacy.cora.services.federated.solr.SolrChardingConnector;
import net.yacy.kelondro.data.meta.DigestURI;
@@ -321,7 +322,7 @@ public class ZURL implements Iterable<ZURL.Entry> {
private boolean error = false;
private kiter(final boolean up, final String firstHash) throws IOException {
- i = urlIndex.rows(up, (firstHash == null) ? null : UTF8.getBytes(firstHash));
+ i = urlIndex.rows(up, (firstHash == null) ? null : ASCII.getBytes(firstHash));
error = false;
}
diff --git a/source/de/anomic/crawler/retrieval/Request.java b/source/de/anomic/crawler/retrieval/Request.java
index e72c85706..03e298175 100755
--- a/source/de/anomic/crawler/retrieval/Request.java
+++ b/source/de/anomic/crawler/retrieval/Request.java
@@ -178,8 +178,7 @@ public class Request extends WorkflowJob {
final byte[] serverdatestr = NaturalOrder.encodeLong(0 /*lastmodified*/, rowdef.width(13));
final byte[] sizestr = NaturalOrder.encodeLong(this.size, rowdef.width(14));
// store the hash in the hash cache
- byte[] namebytes;
- namebytes = UTF8.getBytes(this.name);
+ byte[] namebytes = UTF8.getBytes(this.name);
final byte[][] entry = new byte[][] {
this.url.hash(),
initiator,
diff --git a/source/de/anomic/crawler/retrieval/Response.java b/source/de/anomic/crawler/retrieval/Response.java
index 950904909..6809b499e 100755
--- a/source/de/anomic/crawler/retrieval/Response.java
+++ b/source/de/anomic/crawler/retrieval/Response.java
@@ -30,6 +30,7 @@ import java.io.ByteArrayInputStream;
import java.util.Date;
import net.yacy.cora.date.GenericFormatter;
+import net.yacy.cora.document.ASCII;
import net.yacy.cora.document.UTF8;
import net.yacy.cora.protocol.HeaderFramework;
import net.yacy.cora.protocol.RequestHeader;
@@ -806,7 +807,7 @@ public class Response {
// 6) local fetching for global crawling (other known or unknwon initiator)
EventOrigin processCase = EventOrigin.UNKNOWN;
// FIXME the equals seems to be incorrect: String.equals(boolean)
- if ((initiator() == null) || initiator().length == 0 || UTF8.String(initiator()).equals("------------")) {
+ if (initiator() == null || initiator().length == 0 || ASCII.String(initiator()).equals("------------")) {
// proxy-load
processCase = EventOrigin.PROXY_LOAD;
} else if (UTF8.String(initiator()).equals(mySeedHash)) {
diff --git a/source/de/anomic/data/BookmarkHelper.java b/source/de/anomic/data/BookmarkHelper.java
index 788dbfa1d..8007e7d87 100644
--- a/source/de/anomic/data/BookmarkHelper.java
+++ b/source/de/anomic/data/BookmarkHelper.java
@@ -54,6 +54,7 @@ import org.xml.sax.SAXException;
import de.anomic.data.BookmarksDB.Bookmark;
import de.anomic.data.BookmarksDB.Tag;
import net.yacy.cora.date.ISO8601Formatter;
+import net.yacy.cora.document.ASCII;
import net.yacy.cora.document.MultiProtocolURI;
import net.yacy.cora.document.UTF8;
import net.yacy.document.parser.html.ContentScraper;
@@ -100,7 +101,7 @@ public class BookmarkHelper {
* tagName is converted to lower case before hash is generated!
*/
public static String tagHash(final String tagName){
- return UTF8.String(Word.word2hash(tagName.toLowerCase()));
+ return ASCII.String(Word.word2hash(tagName.toLowerCase()));
}
/*
private static String tagHash(final String tagName, final String user){
diff --git a/source/de/anomic/data/BookmarksDB.java b/source/de/anomic/data/BookmarksDB.java
index c73a053dd..630e3e559 100644
--- a/source/de/anomic/data/BookmarksDB.java
+++ b/source/de/anomic/data/BookmarksDB.java
@@ -36,6 +36,7 @@ import java.util.Set;
import java.util.TreeSet;
import java.util.concurrent.ConcurrentHashMap;
+import net.yacy.cora.document.ASCII;
import net.yacy.cora.document.UTF8;
import net.yacy.kelondro.blob.MapHeap;
import net.yacy.kelondro.data.meta.DigestURI;
@@ -132,7 +133,7 @@ public class BookmarksDB {
// adding a bookmark to the bookmarksDB
public void saveBookmark(final Bookmark bookmark){
try {
- bookmarks.insert(UTF8.getBytes(bookmark.getUrlHash()), bookmark.entry);
+ bookmarks.insert(ASCII.getBytes(bookmark.getUrlHash()), bookmark.entry);
} catch (final Exception e) {
Log.logException(e);
}
@@ -145,7 +146,7 @@ public class BookmarksDB {
public Bookmark getBookmark(final String urlHash){
try {
- final Map<String, String> map = bookmarks.get(UTF8.getBytes(urlHash));
+ final Map<String, String> map = bookmarks.get(ASCII.getBytes(urlHash));
return (map == null) ? null : new Bookmark(map);
} catch (final IOException e) {
Log.logException(e);
@@ -172,7 +173,7 @@ public class BookmarksDB {
Bookmark b;
try {
b = getBookmark(urlHash);
- bookmarks.delete(UTF8.getBytes(urlHash));
+ bookmarks.delete(ASCII.getBytes(urlHash));
} catch (final IOException e) {
b = null;
}
@@ -493,7 +494,7 @@ public class BookmarksDB {
url="http://"+url;
}
try {
- this.urlHash = UTF8.String((new DigestURI(url)).hash());
+ this.urlHash = ASCII.String((new DigestURI(url)).hash());
} catch (final MalformedURLException e) {
this.urlHash = null;
}
@@ -514,7 +515,7 @@ public class BookmarksDB {
}
public Bookmark(final Map<String, String> map) throws MalformedURLException {
- this(UTF8.String((new DigestURI(map.get(BOOKMARK_URL))).hash()), map);
+ this(ASCII.String((new DigestURI(map.get(BOOKMARK_URL))).hash()), map);
}
Map<String, String> toMap() {
diff --git a/source/de/anomic/data/wiki/WikiBoard.java b/source/de/anomic/data/wiki/WikiBoard.java
index 328288df6..31163ddfd 100644
--- a/source/de/anomic/data/wiki/WikiBoard.java
+++ b/source/de/anomic/data/wiki/WikiBoard.java
@@ -35,6 +35,7 @@ import java.util.Locale;
import java.util.Map;
import java.util.TimeZone;
+import net.yacy.cora.document.ASCII;
import net.yacy.cora.document.UTF8;
import net.yacy.kelondro.blob.MapHeap;
import net.yacy.kelondro.index.RowSpaceExceededException;
@@ -331,7 +332,7 @@ public class WikiBoard {
private String getChildName() {
final String c = record.get("child");
final byte[] subject;
- return (c != null && (subject = Base64Order.enhancedCoder.decode(c)) != null) ? UTF8.String(subject) : null;
+ return (c != null && (subject = Base64Order.enhancedCoder.decode(c)) != null) ? ASCII.String(subject) : null;
}
/**
diff --git a/source/de/anomic/http/server/ChunkedOutputStream.java b/source/de/anomic/http/server/ChunkedOutputStream.java
index 0645b3dfb..cadba14da 100644
--- a/source/de/anomic/http/server/ChunkedOutputStream.java
+++ b/source/de/anomic/http/server/ChunkedOutputStream.java
@@ -29,6 +29,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
+import net.yacy.cora.document.ASCII;
import net.yacy.cora.document.UTF8;
import net.yacy.kelondro.util.ByteBuffer;
import net.yacy.kelondro.util.FileUtils;
@@ -61,7 +62,7 @@ public final class ChunkedOutputStream extends FilterOutputStream {
if (this.finished) throw new IOException("ChunkedOutputStream already finalized.");
if (b.length == 0) return;
- this.out.write(UTF8.getBytes(Integer.toHexString(b.length)));
+ this.out.write(ASCII.getBytes(Integer.toHexString(b.length)));
this.out.write(serverCore.CRLF);
this.out.write(b);
this.out.write(serverCore.CRLF);
@@ -72,7 +73,7 @@ public final class ChunkedOutputStream extends FilterOutputStream {
if (this.finished) throw new IOException("ChunkedOutputStream already finalized.");
if (len == 0) return;
- this.out.write(UTF8.getBytes(Integer.toHexString(len)));
+ this.out.write(ASCII.getBytes(Integer.toHexString(len)));
this.out.write(serverCore.CRLF);
this.out.write(b, off, len);
this.out.write(serverCore.CRLF);
@@ -83,7 +84,7 @@ public final class ChunkedOutputStream extends FilterOutputStream {
if (this.finished) throw new IOException("ChunkedOutputStream already finalized.");
if (len == 0) return;
- this.out.write(UTF8.getBytes(Integer.toHexString(len)));
+ this.out.write(ASCII.getBytes(Integer.toHexString(len)));
this.out.write(serverCore.CRLF);
this.out.write(b.getBytes(off, len));
this.out.write(serverCore.CRLF);
@@ -95,7 +96,7 @@ public final class ChunkedOutputStream extends FilterOutputStream {
final int len = b.available();
if (len == 0) return;
- this.out.write(UTF8.getBytes(Integer.toHexString(len)));
+ this.out.write(ASCII.getBytes(Integer.toHexString(len)));
this.out.write(serverCore.CRLF);
FileUtils.copy(b, out, len);
this.out.write(serverCore.CRLF);
diff --git a/source/de/anomic/http/server/HTTPDFileHandler.java b/source/de/anomic/http/server/HTTPDFileHandler.java
index c1d72390a..bfcbf34f8 100644
--- a/source/de/anomic/http/server/HTTPDFileHandler.java
+++ b/source/de/anomic/http/server/HTTPDFileHandler.java
@@ -85,6 +85,7 @@ import java.util.regex.Pattern;
import java.util.zip.GZIPOutputStream;
import net.yacy.cora.date.GenericFormatter;
+import net.yacy.cora.document.ASCII;
import net.yacy.cora.document.UTF8;
import net.yacy.cora.protocol.Domains;
import net.yacy.cora.protocol.HeaderFramework;
@@ -973,7 +974,7 @@ public final class HTTPDFileHandler {
// send page in chunks and parse SSIs
final ByteBuffer o = new ByteBuffer();
// apply templates
- TemplateEngine.writeTemplate(fis, o, templatePatterns, UTF8.getBytes("-UNRESOLVED_PATTERN-"));
+ TemplateEngine.writeTemplate(fis, o, templatePatterns, ASCII.getBytes("-UNRESOLVED_PATTERN-"));
fis.close();
HTTPDemon.sendRespondHeader(conProp, out,
httpVersion, 200, null, mimeType, -1,
@@ -989,7 +990,7 @@ public final class HTTPDFileHandler {
final String contentEncoding = (zipContent) ? "gzip" : null;
// apply templates
final ByteBuffer o1 = new ByteBuffer();
- TemplateEngine.writeTemplate(fis, o1, templatePatterns, UTF8.getBytes("-UNRESOLVED_PATTERN-"));
+ TemplateEngine.writeTemplate(fis, o1, templatePatterns, ASCII.getBytes("-UNRESOLVED_PATTERN-"));
fis.close();
final ByteBuffer o = new ByteBuffer();
diff --git a/source/de/anomic/http/server/HTTPDemon.java b/source/de/anomic/http/server/HTTPDemon.java
index 611145728..42cca5083 100644
--- a/source/de/anomic/http/server/HTTPDemon.java
+++ b/source/de/anomic/http/server/HTTPDemon.java
@@ -50,6 +50,7 @@ import java.util.concurrent.ConcurrentHashMap;
import java.util.regex.Pattern;
import java.util.zip.GZIPInputStream;
+import net.yacy.cora.document.ASCII;
import net.yacy.cora.document.UTF8;
import net.yacy.cora.protocol.Domains;
import net.yacy.cora.protocol.HeaderFramework;
@@ -1108,7 +1109,7 @@ public final class HTTPDemon implements serverHandler, Cloneable {
fis = new FileInputStream(new File(htRootPath, "/proxymsg/error.html")),
o = new ByteArrayOutputStream(512),
tp,
- UTF8.getBytes("-UNRESOLVED_PATTERN-")
+ ASCII.getBytes("-UNRESOLVED_PATTERN-")
);
final byte[] result = o.toByteArray();
o.close(); o = null;
diff --git a/source/de/anomic/search/BlockRank.java b/source/de/anomic/search/BlockRank.java
index 2f462e83d..61f4740f7 100644
--- a/source/de/anomic/search/BlockRank.java
+++ b/source/de/anomic/search/BlockRank.java
@@ -32,7 +32,7 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
-import net.yacy.cora.document.UTF8;
+import net.yacy.cora.document.ASCII;
import net.yacy.cora.storage.OrderedScoreMap;
import net.yacy.cora.storage.ScoreMap;
import net.yacy.kelondro.index.BinSearch;
@@ -166,7 +166,7 @@ public class BlockRank {
for (ReferenceContainer<HostReference> container: index) {
if (container.size() == 0) continue;
if (referenceTable == null) {
- hostStat = hostHashResolver.get(UTF8.String(container.getTermHash()));
+ hostStat = hostHashResolver.get(ASCII.String(container.getTermHash()));
hostCount = hostStat == null ? 6 /* high = a penalty for 'i do not know this', this may not be fair*/ : Math.max(1, hostStat.count);
hostScore.set(container.getTermHash(), container.size() * maxHostCount / hostCount);
} else {
@@ -175,7 +175,7 @@ public class BlockRank {
HostReference hr;
while (hri.hasNext()) {
hr = hri.next();
- hostStat = hostHashResolver.get(UTF8.String(hr.urlhash()));
+ hostStat = hostHashResolver.get(ASCII.String(hr.urlhash()));
hostCount = hostStat == null ? 6 /* high = a penalty for 'i do not know this', this may not be fair*/ : Math.max(1, hostStat.count);
score += (17 - ranking(hr.urlhash(), referenceTable)) * maxHostCount / hostCount;
}
@@ -216,7 +216,7 @@ public class BlockRank {
for (int ybr = 0; ybr < tables.length; ybr++) {
row: for (int i = 0; i < tables[ybr].size(); i++) {
hosth = tables[ybr].get(i, hosth);
- hosths = UTF8.String(hosth);
+ hosths = ASCII.String(hosth);
hostn = myGraph.hostHash2hostName(hosths);
if (hostn == null) {
hs = hostHash2hostName.get(hostn);
diff --git a/source/de/anomic/search/MediaSnippet.java b/source/de/anomic/search/MediaSnippet.java
index 0772a7bf9..4d13a7524 100644
--- a/source/de/anomic/search/MediaSnippet.java
+++ b/source/de/anomic/search/MediaSnippet.java
@@ -37,8 +37,8 @@ import java.util.TreeSet;
import de.anomic.crawler.CrawlProfile;
import de.anomic.data.MimeTable;
+import net.yacy.cora.document.ASCII;
import net.yacy.cora.document.MultiProtocolURI;
-import net.yacy.cora.document.UTF8;
import net.yacy.document.Document;
import net.yacy.document.Parser;
import net.yacy.document.WordTokenizer;
@@ -101,7 +101,7 @@ public class MediaSnippet implements Comparable<MediaSnippet>, Comparator<MediaS
@Override
public String toString() {
- return UTF8.String(href.hash());
+ return ASCII.String(href.hash());
}
@Override
diff --git a/source/de/anomic/search/MetadataRepository.java b/source/de/anomic/search/MetadataRepository.java
index 633071f4f..958eede8a 100644
--- a/source/de/anomic/search/MetadataRepository.java
+++ b/source/de/anomic/search/MetadataRepository.java
@@ -40,6 +40,7 @@ import java.util.TreeSet;
import de.anomic.crawler.CrawlStacker;
+import net.yacy.cora.document.ASCII;
import net.yacy.cora.document.MultiProtocolURI;
import net.yacy.cora.document.UTF8;
import net.yacy.cora.protocol.http.HTTPClient;
@@ -233,7 +234,7 @@ public final class MetadataRepository implements Iterable<byte[]> {
public kiter(final boolean up, final String firstHash) throws IOException {
this.up = up;
- this.iter = urlIndexFile.rows(up, (firstHash == null) ? null : UTF8.getBytes(firstHash));
+ this.iter = urlIndexFile.rows(up, (firstHash == null) ? null : ASCII.getBytes(firstHash));
this.error = false;
}
@@ -294,7 +295,7 @@ public final class MetadataRepository implements Iterable<byte[]> {
final Iterator<String> eiter2 = damagedURLS.iterator();
byte[] urlHashBytes;
while (eiter2.hasNext()) {
- urlHashBytes = UTF8.getBytes(eiter2.next());
+ urlHashBytes = ASCII.getBytes(eiter2.next());
// trying to fix the invalid URL
String oldUrlStr = null;
@@ -315,15 +316,15 @@ public final class MetadataRepository implements Iterable<byte[]> {
&& client.getHttpResponse().getStatusLine().getStatusCode() == 200) {
entry.setCol(1, UTF8.getBytes(newUrl.toString()));
urlIndexFile.put(entry);
- if (log.isInfo()) log.logInfo("UrlDB-Entry with urlHash '" + UTF8.String(urlHashBytes) + "' corrected\n\tURL: " + oldUrlStr + " -> " + newUrlStr);
+ if (log.isInfo()) log.logInfo("UrlDB-Entry with urlHash '" + ASCII.String(urlHashBytes) + "' corrected\n\tURL: " + oldUrlStr + " -> " + newUrlStr);
} else {
remove(urlHashBytes);
- if (log.isInfo()) log.logInfo("UrlDB-Entry with urlHash '" + UTF8.String(urlHashBytes) + "' removed\n\tURL: " + oldUrlStr + "\n\tConnection Status: " + (client.getHttpResponse() == null ? "null" : client.getHttpResponse().getStatusLine()));
+ if (log.isInfo()) log.logInfo("UrlDB-Entry with urlHash '" + ASCII.String(urlHashBytes) + "' removed\n\tURL: " + oldUrlStr + "\n\tConnection Status: " + (client.getHttpResponse() == null ? "null" : client.getHttpResponse().getStatusLine()));
}
}
} catch (final Exception e) {
remove(urlHashBytes);
- if (log.isInfo()) log.logInfo("UrlDB-Entry with urlHash '" + UTF8.String(urlHashBytes) + "' removed\n\tURL: " + oldUrlStr + "\n\tExecption: " + e.getMessage());
+ if (log.isInfo()) log.logInfo("UrlDB-Entry with urlHash '" + ASCII.String(urlHashBytes) + "' removed\n\tURL: " + oldUrlStr + "\n\tExecption: " + e.getMessage());
}
}
@@ -380,12 +381,12 @@ public final class MetadataRepository implements Iterable<byte[]> {
final URIMetadataRow.Components metadata = entry.metadata();
totalSearchedUrls++;
if (metadata == null) {
- if (Log.isFine("URLDBCLEANER")) Log.logFine("URLDBCLEANER", "corrupted entry for hash = " + UTF8.String(entry.hash()));
+ if (Log.isFine("URLDBCLEANER")) Log.logFine("URLDBCLEANER", "corrupted entry for hash = " + ASCII.String(entry.hash()));
remove(entry.hash());
continue;
}
if (metadata.url() == null) {
- if (Log.isFine("URLDBCLEANER")) Log.logFine("URLDBCLEANER", ++blacklistedUrls + " blacklisted (" + ((double) blacklistedUrls / totalSearchedUrls) * 100 + "%): " + UTF8.String(entry.hash()) + "URL == null");
+ if (Log.isFine("URLDBCLEANER")) Log.logFine("URLDBCLEANER", ++blacklistedUrls + " blacklisted (" + ((double) blacklistedUrls / totalSearchedUrls) * 100 + "%): " + ASCII.String(entry.hash()) + "URL == null");
remove(entry.hash());
continue;
}
@@ -393,15 +394,15 @@ public final class MetadataRepository implements Iterable<byte[]> {
blacklist.isListed(Blacklist.BLACKLIST_DHT, metadata.url()) ||
(crawlStacker.urlInAcceptedDomain(metadata.url()) != null)) {
lastBlacklistedUrl = metadata.url().toNormalform(true, true);
- lastBlacklistedHash = UTF8.String(entry.hash());
- if (Log.isFine("URLDBCLEANER")) Log.logFine("URLDBCLEANER", ++blacklistedUrls + " blacklisted (" + ((double) blacklistedUrls / totalSearchedUrls) * 100 + "%): " + UTF8.String(entry.hash()) + " " + metadata.url().toNormalform(false, true));
+ lastBlacklistedHash = ASCII.String(entry.hash());
+ if (Log.isFine("URLDBCLEANER")) Log.logFine("URLDBCLEANER", ++blacklistedUrls + " blacklisted (" + ((double) blacklistedUrls / totalSearchedUrls) * 100 + "%): " + ASCII.String(entry.hash()) + " " + metadata.url().toNormalform(false, true));
remove(entry.hash());
if (blacklistedUrls % 100 == 0) {
Log.logInfo("URLDBCLEANER", "Deleted " + blacklistedUrls + " URLs until now. Last deleted URL-Hash: " + lastBlacklistedUrl);
}
}
lastUrl = metadata.url().toNormalform(true, true);
- lastHash = UTF8.String(entry.hash());
+ lastHash = ASCII.String(entry.hash());
}
}
} catch (final RuntimeException e) {
@@ -536,7 +537,7 @@ public final class MetadataRepository implements Iterable<byte[]> {
if (metadata.dc_subject().length() > 0) pw.println("<description>" + CharacterCoding.unicode2xml(metadata.dc_subject(), true) + "</description>");
pw.println("<pubDate>" + entry.moddate().toString() + "</pubDate>");
pw.println("<yacy:size>" + entry.size() + "</yacy:size>");
- pw.println("<guid isPermaLink=\"false\">" + UTF8.String(entry.hash()) + "</guid>");
+ pw.println("<guid isPermaLink=\"false\">" + ASCII.String(entry.hash()) + "</guid>");
pw.println("</item>");
}
count++;
@@ -589,7 +590,7 @@ public final class MetadataRepository implements Iterable<byte[]> {
URLHashCounter ds;
if (i != null) while (i.hasNext()) {
urlhashb = i.next();
- hosthash = UTF8.String(urlhashb).substring(6);
+ hosthash = ASCII.String(urlhashb).substring(6);
ds = map.get(hosthash);
if (ds == null) {
ds = new URLHashCounter(urlhashb);
@@ -636,7 +637,7 @@ public final class MetadataRepository implements Iterable<byte[]> {
public ScoreMap<String> urlSampleScores(Map<String, URLHashCounter> domainSamples) {
ScoreMap<String> urlSampleScore = new ConcurrentScoreMap<String>();
for (Map.Entry<String, URLHashCounter> e: domainSamples.entrySet()) {
- urlSampleScore.inc(UTF8.String(e.getValue().urlhashb), e.getValue().count);
+ urlSampleScore.inc(ASCII.String(e.getValue().urlhashb), e.getValue().count);
}
return urlSampleScore;
}
@@ -652,7 +653,7 @@ public final class MetadataRepository implements Iterable<byte[]> {
ScoreMap<String> hosthashScore = new ConcurrentScoreMap<String>();
for (Map.Entry<String, URLHashCounter> e: domainSamples.entrySet()) {
- hosthashScore.inc(UTF8.String(e.getValue().urlhashb).substring(6), e.getValue().count);
+ hosthashScore.inc(ASCII.String(e.getValue().urlhashb).substring(6), e.getValue().count);
}
URIMetadataRow.Components comps;
DigestURI url;
@@ -681,7 +682,7 @@ public final class MetadataRepository implements Iterable<byte[]> {
while (j.hasNext()) {
urlhash = j.next();
if (urlhash == null) continue;
- urlref = this.load(UTF8.getBytes(urlhash));
+ urlref = this.load(ASCII.getBytes(urlhash));
if (urlref == null || urlref.metadata() == null || urlref.metadata().url() == null || urlref.metadata().url().getHost() == null) continue;
if (statsDump == null) return new ArrayList<HostStat>().iterator(); // some other operation has destroyed the object
comps = urlref.metadata();
@@ -730,14 +731,14 @@ public final class MetadataRepository implements Iterable<byte[]> {
CloneableIterator<byte[]> i = this.urlIndexFile.keys(true, null);
String hash;
while (i != null && i.hasNext()) {
- hash = UTF8.String(i.next());
+ hash = ASCII.String(i.next());
if (hosthash.equals(hash.substring(6))) l.add(hash);
}
// then delete the urls using this list
int cnt = 0;
for (String h: l) {
- if (urlIndexFile.delete(UTF8.getBytes(h))) cnt++;
+ if (urlIndexFile.delete(ASCII.getBytes(h))) cnt++;
}
// finally remove the line with statistics
diff --git a/source/de/anomic/search/QueryParams.java b/source/de/anomic/search/QueryParams.java
index 4cfc2df17..c8a354049 100644
--- a/source/de/anomic/search/QueryParams.java
+++ b/source/de/anomic/search/QueryParams.java
@@ -37,6 +37,7 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException;
+import net.yacy.cora.document.ASCII;
import net.yacy.cora.document.MultiProtocolURI;
import net.yacy.cora.document.UTF8;
import net.yacy.document.Condenser;
@@ -261,7 +262,7 @@ public final class QueryParams {
final HandleSet keyhashes = new HandleSet(WordReferenceRow.urlEntryRow.primaryKeyLength, WordReferenceRow.urlEntryRow.objectOrder, 0);
if (query != null) {
for (int i = 0; i < (query.length() / Word.commonHashLength); i++) try {
- keyhashes.put(UTF8.getBytes(query.substring(i * Word.commonHashLength, (i + 1) * Word.commonHashLength)));
+ keyhashes.put(ASCII.getBytes(query.substring(i * Word.commonHashLength, (i + 1) * Word.commonHashLength)));
} catch (RowSpaceExceededException e) {
Log.logException(e);
}
@@ -273,7 +274,7 @@ public final class QueryParams {
final HandleSet keyhashes = new HandleSet(WordReferenceRow.urlEntryRow.primaryKeyLength, WordReferenceRow.urlEntryRow.objectOrder, 0);
if (query != null) {
for (int i = 0; i < (query.length() / Word.commonHashLength); i++) try {
- keyhashes.put(UTF8.getBytes(query.substring(i * Word.commonHashLength, (i + 1) * Word.commonHashLength)));
+ keyhashes.put(ASCII.getBytes(query.substring(i * Word.commonHashLength, (i + 1) * Word.commonHashLength)));
} catch (RowSpaceExceededException e) {
Log.logException(e);
}
@@ -285,11 +286,11 @@ public final class QueryParams {
final byte[] bb = new byte[hashes.size() * Word.commonHashLength];
int p = 0;
for (final byte[] b : hashes) {
- assert b.length == Word.commonHashLength : "hash = " + UTF8.String(b);
+ assert b.length == Word.commonHashLength : "hash = " + ASCII.String(b);
System.arraycopy(b, 0, bb, p, Word.commonHashLength);
p += Word.commonHashLength;
}
- return UTF8.String(bb);
+ return ASCII.String(bb);
}
public static String anonymizedQueryHashes(final HandleSet hashes) {
@@ -300,11 +301,11 @@ public final class QueryParams {
byte[] hash;
if (i.hasNext()) {
hash = i.next();
- sb.append(UTF8.String(hash).substring(0, 3)).append(".........");
+ sb.append(ASCII.String(hash).substring(0, 3)).append(".........");
}
while (i.hasNext()) {
hash = i.next();
- sb.append(", ").append(UTF8.String(hash).substring(0, 3)).append(".........");
+ sb.append(", ").append(ASCII.String(hash).substring(0, 3)).append(".........");
}
sb.append("]");
return sb.toString();
@@ -452,7 +453,7 @@ public final class QueryParams {
context.append(asterisk);
context.append(this.zonecode);
context.append(asterisk);
- context.append(UTF8.String(Word.word2hash(this.ranking.toExternalString())));
+ context.append(ASCII.String(Word.word2hash(this.ranking.toExternalString())));
context.append(asterisk);
context.append(this.prefer);
context.append(asterisk);
diff --git a/source/de/anomic/search/RankingProcess.java b/source/de/anomic/search/RankingProcess.java
index 4c114667f..373034cf5 100644
--- a/source/de/anomic/search/RankingProcess.java
+++ b/source/de/anomic/search/RankingProcess.java
@@ -38,8 +38,8 @@ import java.util.concurrent.BlockingQueue;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.TimeUnit;
+import net.yacy.cora.document.ASCII;
import net.yacy.cora.document.MultiProtocolURI;
-import net.yacy.cora.document.UTF8;
import net.yacy.cora.protocol.Scanner;
import net.yacy.cora.storage.ConcurrentScoreMap;
import net.yacy.cora.storage.ClusteredScoreMap;
@@ -227,7 +227,7 @@ public final class RankingProcess extends Thread {
//this.domZones[DigestURI.domDomain(iEntry.metadataHash())]++;
// check site constraints
- String urlhashs = UTF8.String(iEntry.urlhash());
+ String urlhashs = ASCII.String(iEntry.urlhash());
String hosthash = urlhashs.substring(6);
if (query.sitehash == null) {
// no site constraint there; maybe collect host navigation information
@@ -333,7 +333,7 @@ public final class RankingProcess extends Thread {
}
// check doubledom
- final String domhash = UTF8.String(rwi.getElement().urlhash(), 6, 6);
+ final String domhash = ASCII.String(rwi.getElement().urlhash(), 6, 6);
synchronized (this.doubleDomCache) {
m = this.doubleDomCache.get(domhash);
if (m == null) {
@@ -377,7 +377,7 @@ public final class RankingProcess extends Thread {
if (bestEntry == null) return null;
// finally remove the best entry from the doubledom cache
- m = this.doubleDomCache.get(UTF8.String(bestEntry.getElement().urlhash()).substring(6));
+ m = this.doubleDomCache.get(ASCII.String(bestEntry.getElement().urlhash()).substring(6));
bestEntry = m.poll();
}
return bestEntry;
@@ -482,7 +482,7 @@ public final class RankingProcess extends Thread {
// author navigation:
if (pageauthor != null && pageauthor.length() > 0) {
// add author to the author navigator
- String authorhash = UTF8.String(Word.word2hash(pageauthor));
+ String authorhash = ASCII.String(Word.word2hash(pageauthor));
// check if we already are filtering for authors
if (this.query.authorhash != null && !this.query.authorhash.equals(authorhash)) {
@@ -604,7 +604,7 @@ public final class RankingProcess extends Thread {
domhash = domhashs.next();
if (domhash == null) continue;
urlhash = this.hostResolver.get(domhash);
- row = urlhash == null ? null : this.query.getSegment().urlMetadata().load(UTF8.getBytes(urlhash));
+ row = urlhash == null ? null : this.query.getSegment().urlMetadata().load(ASCII.getBytes(urlhash));
hostname = row == null ? null : row.metadata().url().getHost();
if (hostname != null) {
result.set(hostname, this.hostNavigator.get(domhash));
diff --git a/source/de/anomic/search/ReferenceOrder.java b/source/de/anomic/search/ReferenceOrder.java
index dcb81bbad..3961e447c 100644
--- a/source/de/anomic/search/ReferenceOrder.java
+++ b/source/de/anomic/search/ReferenceOrder.java
@@ -33,7 +33,7 @@ import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.Semaphore;
-import net.yacy.cora.document.UTF8;
+import net.yacy.cora.document.ASCII;
import net.yacy.cora.storage.ReversibleScoreMap;
import net.yacy.cora.storage.ClusteredScoreMap;
import net.yacy.document.Condenser;
@@ -163,7 +163,7 @@ public class ReferenceOrder {
if (max == null) max = iEntry.clone(); else max.max(iEntry);
out.put(iEntry); // must be after the min/max check to prevent that min/max is null in cardinal()
// update domcount
- dom = UTF8.String(iEntry.urlhash(), 6, 6);
+ dom = ASCII.String(iEntry.urlhash(), 6, 6);
count = doms0.get(dom);
if (count == null) {
doms0.put(dom, int1);
@@ -195,7 +195,7 @@ public class ReferenceOrder {
}
public int authority(final byte[] urlHash) {
- return (doms.get(UTF8.String(urlHash, 6, 6)) << 8) / (1 + this.maxdomcount);
+ return (doms.get(ASCII.String(urlHash, 6, 6)) << 8) / (1 + this.maxdomcount);
}
/**
diff --git a/source/de/anomic/search/SearchEvent.java b/source/de/anomic/search/SearchEvent.java
index 6eb0884a5..281f4a423 100644
--- a/source/de/anomic/search/SearchEvent.java
+++ b/source/de/anomic/search/SearchEvent.java
@@ -35,6 +35,7 @@ import java.util.TreeSet;
import java.util.concurrent.Semaphore;
import java.util.concurrent.TimeUnit;
+import net.yacy.cora.document.ASCII;
import net.yacy.cora.document.UTF8;
import net.yacy.cora.storage.ScoreMap;
import net.yacy.document.LargeNumberCache;
@@ -174,7 +175,7 @@ public final class SearchEvent {
for (final Map.Entry<byte[], ReferenceContainer<WordReference>> entry : this.rankingProcess.searchContainerMap().entrySet()) {
wordhash = entry.getKey();
final ReferenceContainer<WordReference> container = entry.getValue();
- assert (Base64Order.enhancedCoder.equal(container.getTermHash(), wordhash)) : "container.getTermHash() = " + UTF8.String(container.getTermHash()) + ", wordhash = " + UTF8.String(wordhash);
+ assert (Base64Order.enhancedCoder.equal(container.getTermHash(), wordhash)) : "container.getTermHash() = " + ASCII.String(container.getTermHash()) + ", wordhash = " + ASCII.String(wordhash);
if (container.size() > maxcount) {
IAmaxcounthash = wordhash;
maxcount = container.size();
diff --git a/source/de/anomic/search/Segment.java b/source/de/anomic/search/Segment.java
index 036086bfa..3cdfb34b9 100644
--- a/source/de/anomic/search/Segment.java
+++ b/source/de/anomic/search/Segment.java
@@ -34,6 +34,7 @@ import java.util.Map;
import java.util.Set;
import java.util.TreeSet;
+import net.yacy.cora.document.ASCII;
import net.yacy.cora.document.MultiProtocolURI;
import net.yacy.cora.document.UTF8;
import net.yacy.document.Condenser;
@@ -335,7 +336,7 @@ public class Segment {
modDate, // modification date
loadDate, // loaded date
new Date(loadDate.getTime() + Math.max(0, loadDate.getTime() - modDate.getTime()) / 2), // freshdate, computed with Proxy-TTL formula
- (referrerURL == null) ? null : UTF8.String(referrerURL.hash()), // referer hash
+ (referrerURL == null) ? null : ASCII.String(referrerURL.hash()), // referer hash
new byte[0], // md5
(int) sourcesize, // size
condenser.RESULT_NUMB_WORDS, // word count
@@ -375,7 +376,7 @@ public class Segment {
// TODO: UTF-8 docDescription seems not to be displayed correctly because
// of string concatenation
log.logInfo("*Indexed " + words + " words in URL " + url +
- " [" + UTF8.String(url.hash()) + "]" +
+ " [" + ASCII.String(url.hash()) + "]" +
"\n\tDescription: " + dc_title +
"\n\tMimeType: " + document.dc_format() + " | Charset: " + document.getCharset() + " | " +
"Size: " + document.getTextLength() + " bytes | " +
@@ -493,7 +494,7 @@ public class Segment {
}
if (!urlHashs.isEmpty()) try {
final int removed = termIndex.remove(container.getTermHash(), urlHashs);
- Log.logFine("INDEXCLEANER", UTF8.String(container.getTermHash()) + ": " + removed + " of " + container.size() + " URL-entries deleted");
+ Log.logFine("INDEXCLEANER", ASCII.String(container.getTermHash()) + ": " + removed + " of " + container.size() + " URL-entries deleted");
lastWordHash = container.getTermHash();
lastDeletionCounter = urlHashs.size();
urlHashs.clear();
diff --git a/source/de/anomic/search/Switchboard.java b/source/de/anomic/search/Switchboard.java
index 0dd31254e..ca163e669 100644
--- a/source/de/anomic/search/Switchboard.java
+++ b/source/de/anomic/search/Switchboard.java
@@ -75,6 +75,7 @@ import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
import net.yacy.cora.date.GenericFormatter;
+import net.yacy.cora.document.ASCII;
import net.yacy.cora.document.MultiProtocolURI;
import net.yacy.cora.document.RSSFeed;
import net.yacy.cora.document.RSSMessage;
@@ -1131,7 +1132,7 @@ public final class Switchboard extends serverSwitch {
return network.indexOf(peer) >= 0;
} else if (clustermode.equals(SwitchboardConstants.CLUSTER_MODE_PUBLIC_CLUSTER)) {
// check if we got the request from a peer in the public cluster
- return this.clusterhashes.containsKey(UTF8.getBytes(peer));
+ return this.clusterhashes.containsKey(ASCII.getBytes(peer));
} else {
return false;
}
@@ -1149,7 +1150,7 @@ public final class Switchboard extends serverSwitch {
return network.indexOf(seed.getPublicAddress()) >= 0;
} else if (clustermode.equals(SwitchboardConstants.CLUSTER_MODE_PUBLIC_CLUSTER)) {
// check if we got the request from a peer in the public cluster
- return this.clusterhashes.containsKey(UTF8.getBytes(seed.hash));
+ return this.clusterhashes.containsKey(ASCII.getBytes(seed.hash));
} else {
return false;
}
@@ -1165,7 +1166,7 @@ public final class Switchboard extends serverSwitch {
public void urlRemove(final Segment segment, final byte[] hash) {
segment.urlMetadata().remove(hash);
- ResultURLs.remove(UTF8.String(hash));
+ ResultURLs.remove(ASCII.String(hash));
crawlQueues.urlRemove(hash);
}
@@ -1451,7 +1452,7 @@ public final class Switchboard extends serverSwitch {
// create a queue entry
Document document = surrogate.document();
Request request = new Request(
- UTF8.getBytes(peers.mySeed().hash),
+ ASCII.getBytes(peers.mySeed().hash),
surrogate.getIdentifier(true),
null,
"",
@@ -1878,7 +1879,7 @@ public final class Switchboard extends serverSwitch {
", maxDepth=" + ((response.profile() == null) ? "null" : Integer.toString(response.profile().depth())) +
", must-match=" + ((response.profile() == null) ? "null" : response.profile().mustMatchPattern().toString()) +
", must-not-match=" + ((response.profile() == null) ? "null" : response.profile().mustNotMatchPattern().toString()) +
- ", initiatorHash=" + ((response.initiator() == null) ? "null" : UTF8.String(response.initiator())) +
+ ", initiatorHash=" + ((response.initiator() == null) ? "null" : ASCII.String(response.initiator())) +
//", responseHeader=" + ((entry.responseHeader() == null) ? "null" : entry.responseHeader().toString()) +
", url=" + response.url()); // DEBUG
}
@@ -2092,7 +2093,7 @@ public final class Switchboard extends serverSwitch {
condenser,
searchEvent,
sourceName);
- yacyChannel.channels(Base64Order.enhancedCoder.equal(queueEntry.initiator(), UTF8.getBytes(peers.mySeed().hash)) ? yacyChannel.LOCALINDEXING : yacyChannel.REMOTEINDEXING).addMessage(new RSSMessage("Indexed web page", dc_title, queueEntry.url().toNormalform(true, false)));
+ yacyChannel.channels(Base64Order.enhancedCoder.equal(queueEntry.initiator(), ASCII.getBytes(peers.mySeed().hash)) ? yacyChannel.LOCALINDEXING : yacyChannel.REMOTEINDEXING).addMessage(new RSSMessage("Indexed web page", dc_title, queueEntry.url().toNormalform(true, false)));
} catch (final IOException e) {
//if (this.log.isFine()) log.logFine("Not Indexed Resource '" + queueEntry.url().toNormalform(false, true) + "': process case=" + processCase);
addURLtoErrorDB(queueEntry.url(), (referrerURL == null) ? null : referrerURL.hash(), queueEntry.initiator(), dc_title, FailCategory.FINAL_LOAD_CONTEXT, "error storing url: " + queueEntry.url().toNormalform(false, true) + "': process case=" + processCase + ", error = " + e.getMessage());
@@ -2135,13 +2136,13 @@ public final class Switchboard extends serverSwitch {
// if this was performed for a remote crawl request, notify requester
if ((processCase == EventOrigin.GLOBAL_CRAWLING) && (queueEntry.initiator() != null)) {
- final yacySeed initiatorPeer = peers.get(UTF8.String(queueEntry.initiator()));
+ final yacySeed initiatorPeer = peers.get(ASCII.String(queueEntry.initiator()));
if (initiatorPeer != null) {
if (clusterhashes != null) {
initiatorPeer.setAlternativeAddress(clusterhashes.get(queueEntry.initiator()));
}
// start a thread for receipt sending to avoid a blocking here
- new Thread(new receiptSending(initiatorPeer, newEntry), "sending receipt to " + UTF8.String(queueEntry.initiator())).start();
+ new Thread(new receiptSending(initiatorPeer, newEntry), "sending receipt to " + ASCII.String(queueEntry.initiator())).start();
}
}
}
@@ -2195,7 +2196,7 @@ public final class Switchboard extends serverSwitch {
}
if (indexSegments.segment(process).urlMetadata.exists(url.hash())) return; // don't do double-work
final Request request = loader.request(url, true, true);
- final CrawlProfile profile = sb.crawler.getActive(UTF8.getBytes(request.profileHandle()));
+ final CrawlProfile profile = sb.crawler.getActive(ASCII.getBytes(request.profileHandle()));
String acceptedError = this.crawlStacker.checkAcceptance(url, profile, 0);
if (acceptedError != null) {
log.logWarning("addToIndex: cannot load " + url.toNormalform(false, false) + ": " + acceptedError);
@@ -2443,8 +2444,8 @@ public final class Switchboard extends serverSwitch {
log.logInfo("dhtTransferJob: approaching full DHT dispersion.");
return false;
}
- log.logInfo("dhtTransferJob: selected " + UTF8.String(startHash) + " as start hash");
- log.logInfo("dhtTransferJob: selected " + UTF8.String(limitHash) + " as limit hash");
+ log.logInfo("dhtTransferJob: selected " + ASCII.String(startHash) + " as start hash");
+ log.logInfo("dhtTransferJob: selected " + ASCII.String(limitHash) + " as limit hash");
boolean enqueued = this.dhtDispatcher.selectContainersEnqueueToCloud(
startHash,
limitHash,
diff --git a/source/de/anomic/search/TextSnippet.java b/source/de/anomic/search/TextSnippet.java
index c1d99595b..f1c3f91c6 100644
--- a/source/de/anomic/search/TextSnippet.java
+++ b/source/de/anomic/search/TextSnippet.java
@@ -32,7 +32,7 @@ import java.util.SortedMap;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-import net.yacy.cora.document.UTF8;
+import net.yacy.cora.document.ASCII;
import net.yacy.cora.storage.ARC;
import net.yacy.cora.storage.ConcurrentARC;
import net.yacy.document.Document;
@@ -46,6 +46,7 @@ import net.yacy.kelondro.data.word.Word;
import net.yacy.kelondro.index.HandleSet;
import net.yacy.kelondro.order.Base64Order;
import net.yacy.kelondro.util.ByteArray;
+import net.yacy.kelondro.util.ByteBuffer;
import net.yacy.repository.LoaderDispatcher;
import de.anomic.crawler.CrawlProfile;
@@ -160,7 +161,7 @@ public class TextSnippet implements Comparable<TextSnippet>, Comparator<TextSnip
// try to get snippet from snippetCache
ResultClass source = ResultClass.SOURCE_CACHE;
final String wordhashes = yacySearch.set2string(queryhashes);
- final String urls = UTF8.String(url.hash());
+ final String urls = ASCII.String(url.hash());
String snippetLine = snippetsCache.get(wordhashes, urls);
if (snippetLine != null) {
// found the snippet
@@ -177,7 +178,7 @@ public class TextSnippet implements Comparable<TextSnippet>, Comparator<TextSnip
try {
// first try to get the snippet from metadata
String loc;
- boolean noCacheUsage = url.isFile() || url.isSMB();
+ boolean noCacheUsage = url.isFile() || url.isSMB() || cacheStrategy == null;
boolean objectWasInCache = (noCacheUsage) ? false : de.anomic.http.client.Cache.has(url);
boolean useMetadata = !objectWasInCache && (cacheStrategy == null || !cacheStrategy.mustBeOffline());
if (useMetadata && containsAllHashes(loc = comp.dc_title(), queryhashes)) {
@@ -397,7 +398,7 @@ public class TextSnippet implements Comparable<TextSnippet>, Comparator<TextSnip
out = new StringBuilder(80);
//is character a special character?
if(p4.matcher(theWord.substring(k,k+1)).find()) {
- if (UTF8.String(Word.word2hash(temp)).equals(UTF8.String(h))) temp = "<b>" + CharacterCoding.unicode2html(temp, false) + "</b>";
+ if (ByteBuffer.equals(Word.word2hash(temp), h)) temp = "<b>" + CharacterCoding.unicode2html(temp, false) + "</b>";
out.append(temp);
out.append(CharacterCoding.unicode2html(theWord.substring(k,k+1), false));
temp = "";
@@ -405,7 +406,7 @@ public class TextSnippet implements Comparable<TextSnippet>, Comparator<TextSnip
//last character
else if(k == (theWord.length()-1)) {
temp = temp + theWord.substring(k,k+1);
- if (UTF8.String(Word.word2hash(temp)).equals(UTF8.String(h))) temp = "<b>" + CharacterCoding.unicode2html(temp, false) + "</b>";
+ if (ByteBuffer.equals(Word.word2hash(temp), h)) temp = "<b>" + CharacterCoding.unicode2html(temp, false) + "</b>";
out.append(temp);
temp = "";
}
@@ -417,7 +418,7 @@ public class TextSnippet implements Comparable<TextSnippet>, Comparator<TextSnip
}
//end contrib [MN]
- else if (UTF8.String(Word.word2hash(theWord)).equals(UTF8.String(h))) {
+ else if (ByteBuffer.equals(Word.word2hash(theWord), h)) {
theWord.replace(0, theWord.length(), CharacterCoding.unicode2html(theWord.toString(), false));
theWord.insert(0, "<b>");
theWord.append("</b>");
diff --git a/source/de/anomic/yacy/dht/Dispatcher.java b/source/de/anomic/yacy/dht/Dispatcher.java
index 966059387..434b1af4f 100755
--- a/source/de/anomic/yacy/dht/Dispatcher.java
+++ b/source/de/anomic/yacy/dht/Dispatcher.java
@@ -31,7 +31,7 @@ import java.util.Iterator;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
-import net.yacy.cora.document.UTF8;
+import net.yacy.cora.document.ASCII;
import net.yacy.kelondro.data.meta.URIMetadataRow;
import net.yacy.kelondro.data.word.WordReference;
import net.yacy.kelondro.index.HandleSet;
@@ -199,7 +199,7 @@ public class Dispatcher {
urlHashes.clear();
it = c.entries();
while (it.hasNext()) try { urlHashes.put(it.next().urlhash()); } catch (RowSpaceExceededException e) { Log.logException(e); }
- if (this.log.isFine()) this.log.logFine("selected " + urlHashes.size() + " urls for word '" + UTF8.String(c.getTermHash()) + "'");
+ if (this.log.isFine()) this.log.logFine("selected " + urlHashes.size() + " urls for word '" + ASCII.String(c.getTermHash()) + "'");
if (!urlHashes.isEmpty()) this.segment.termIndex().remove(c.getTermHash(), urlHashes);
}
rc = containers;
@@ -210,7 +210,7 @@ public class Dispatcher {
for (ReferenceContainer<WordReference> c: containers) {
container = this.segment.termIndex().delete(c.getTermHash()); // be aware this might be null!
if (container != null && !container.isEmpty()) {
- if (this.log.isFine()) this.log.logFine("selected " + container.size() + " urls for word '" + UTF8.String(c.getTermHash()) + "'");
+ if (this.log.isFine()) this.log.logFine("selected " + container.size() + " urls for word '" + ASCII.String(c.getTermHash()) + "'");
rc.add(container);
}
}
@@ -291,7 +291,7 @@ public class Dispatcher {
primaryTarget,
seeds.redundancy() * 3,
true);
- this.log.logInfo("enqueueContainers: selected " + targets.size() + " targets for primary target key " + UTF8.String(primaryTarget) + "/" + vertical + " with " + containers[vertical].size() + " index containers.");
+ this.log.logInfo("enqueueContainers: selected " + targets.size() + " targets for primary target key " + ASCII.String(primaryTarget) + "/" + vertical + " with " + containers[vertical].size() + " index containers.");
if (entry == null) entry = transmission.newChunk(primaryTarget, targets);
/*/ lookup targets
@@ -398,11 +398,11 @@ public class Dispatcher {
if (success && chunk.isFinished()) {
// finished with this queue!
- this.log.logInfo("STORE: Chunk " + UTF8.String(chunk.primaryTarget()) + " has FINISHED all transmissions!");
+ this.log.logInfo("STORE: Chunk " + ASCII.String(chunk.primaryTarget()) + " has FINISHED all transmissions!");
return chunk;
}
- if (!success) this.log.logInfo("STORE: Chunk " + UTF8.String(chunk.primaryTarget()) + " has failed to transmit index; marked peer as busy");
+ if (!success) this.log.logInfo("STORE: Chunk " + ASCII.String(chunk.primaryTarget()) + " has failed to transmit index; marked peer as busy");
if (chunk.canFinish()) {
try {
@@ -413,7 +413,7 @@ public class Dispatcher {
}
return chunk;
}
- this.log.logInfo("STORE: Chunk " + UTF8.String(chunk.primaryTarget()) + " has not enough targets left. This transmission has failed, putting back index to backend");
+ this.log.logInfo("STORE: Chunk " + ASCII.String(chunk.primaryTarget()) + " has not enough targets left. This transmission has failed, putting back index to backend");
chunk.restore();
return null;
}
diff --git a/source/de/anomic/yacy/dht/FlatWordPartitionScheme.java b/source/de/anomic/yacy/dht/FlatWordPartitionScheme.java
index 787f70bde..0b6496ad6 100755
--- a/source/de/anomic/yacy/dht/FlatWordPartitionScheme.java
+++ b/source/de/anomic/yacy/dht/FlatWordPartitionScheme.java
@@ -28,7 +28,7 @@ package de.anomic.yacy.dht;
import java.util.Random;
import java.util.TreeMap;
-import net.yacy.cora.document.UTF8;
+import net.yacy.cora.document.ASCII;
import net.yacy.kelondro.index.HandleMap;
import net.yacy.kelondro.index.RowSpaceExceededException;
import net.yacy.kelondro.logging.Log;
@@ -61,7 +61,7 @@ public class FlatWordPartitionScheme implements PartitionScheme {
}
public final long dhtDistance(final byte[] word, final String urlHash, final yacySeed peer) {
- return dhtDistance(word, urlHash, UTF8.getBytes(peer.hash));
+ return dhtDistance(word, urlHash, ASCII.getBytes(peer.hash));
}
private final long dhtDistance(final byte[] from, final String urlHash, final byte[] to) {
@@ -96,9 +96,9 @@ public class FlatWordPartitionScheme implements PartitionScheme {
public static byte[] positionToHash(final long l) {
// transform the position of a peer position into a close peer hash
- String s = UTF8.String(Base64Order.enhancedCoder.uncardinal(l));
+ String s = ASCII.String(Base64Order.enhancedCoder.uncardinal(l));
while (s.length() < 12) s += "A";
- return UTF8.getBytes(s);
+ return ASCII.getBytes(s);
}
diff --git a/source/de/anomic/yacy/dht/PeerSelection.java b/source/de/anomic/yacy/dht/PeerSelection.java
index 7a2315ee0..a87cecd9c 100755
--- a/source/de/anomic/yacy/dht/PeerSelection.java
+++ b/source/de/anomic/yacy/dht/PeerSelection.java
@@ -34,7 +34,7 @@ import java.util.Set;
import java.util.SortedMap;
import net.yacy.cora.date.AbstractFormatter;
-import net.yacy.cora.document.UTF8;
+import net.yacy.cora.document.ASCII;
import net.yacy.cora.storage.ConcurrentScoreMap;
import net.yacy.cora.storage.ScoreMap;
import net.yacy.kelondro.data.word.Word;
@@ -65,7 +65,7 @@ public class PeerSelection {
yacySeed s;
while (i.hasNext()) {
entry = i.next();
- s = seedDB.get(UTF8.String(entry.getKey())); // should be getConnected; get only during testing time
+ s = seedDB.get(ASCII.String(entry.getKey())); // should be getConnected; get only during testing time
if (s != null) {
s.setAlternativeAddress(entry.getValue());
l.add(s);
@@ -191,12 +191,12 @@ public class PeerSelection {
}
public static byte[] selectTransferStart() {
- return UTF8.getBytes(Base64Order.enhancedCoder.encode(Digest.encodeMD5Raw(Long.toString(System.currentTimeMillis()))).substring(2, 2 + Word.commonHashLength));
+ return ASCII.getBytes(Base64Order.enhancedCoder.encode(Digest.encodeMD5Raw(Long.toString(System.currentTimeMillis()))).substring(2, 2 + Word.commonHashLength));
}
public static byte[] limitOver(final yacySeedDB seedDB, final byte[] startHash) {
final Iterator<yacySeed> seeds = getAcceptRemoteIndexSeeds(seedDB, startHash, 1, false);
- if (seeds.hasNext()) return UTF8.getBytes(seeds.next().hash);
+ if (seeds.hasNext()) return ASCII.getBytes(seeds.next().hash);
return null;
}
@@ -239,7 +239,7 @@ public class PeerSelection {
this.remaining = max;
this.doublecheck = new HandleSet(12, Base64Order.enhancedCoder, 0);
this.nextSeed = nextInternal();
- this.alsoMyOwn = alsoMyOwn && nextSeed != null && (Base64Order.enhancedCoder.compare(UTF8.getBytes(seedDB.mySeed().hash), UTF8.getBytes(nextSeed.hash)) > 0);
+ this.alsoMyOwn = alsoMyOwn && nextSeed != null && (Base64Order.enhancedCoder.compare(ASCII.getBytes(seedDB.mySeed().hash), ASCII.getBytes(nextSeed.hash)) > 0);
}
public boolean hasNext() {
@@ -253,7 +253,7 @@ public class PeerSelection {
while (se.hasNext()) {
s = se.next();
if (s == null) return null;
- byte[] hashb = UTF8.getBytes(s.hash);
+ byte[] hashb = ASCII.getBytes(s.hash);
if (doublecheck.has(hashb)) return null;
try {
this.doublecheck.put(hashb);
@@ -276,7 +276,7 @@ public class PeerSelection {
}
public yacySeed next() {
- if (alsoMyOwn && Base64Order.enhancedCoder.compare(UTF8.getBytes(seedDB.mySeed().hash), UTF8.getBytes(nextSeed.hash)) < 0) {
+ if (alsoMyOwn && Base64Order.enhancedCoder.compare(ASCII.getBytes(seedDB.mySeed().hash), ASCII.getBytes(nextSeed.hash)) < 0) {
// take my own seed hash instead the enumeration result
alsoMyOwn = false;
return seedDB.mySeed();
diff --git a/source/de/anomic/yacy/dht/Transmission.java b/source/de/anomic/yacy/dht/Transmission.java
index 00bad6b2a..ed992e037 100644
--- a/source/de/anomic/yacy/dht/Transmission.java
+++ b/source/de/anomic/yacy/dht/Transmission.java
@@ -28,7 +28,7 @@ import java.util.ArrayList;
import java.util.Iterator;
import java.util.TreeMap;
-import net.yacy.cora.document.UTF8;
+import net.yacy.cora.document.ASCII;
import net.yacy.kelondro.data.meta.URIMetadataRow;
import net.yacy.kelondro.data.word.Word;
import net.yacy.kelondro.data.word.WordReference;
@@ -193,7 +193,7 @@ public class Transmission {
log.logInfo("Transfer of chunk to myself-target");
return true;
}
- log.logInfo("starting new index transmission request to " + UTF8.String(this.primaryTarget));
+ log.logInfo("starting new index transmission request to " + ASCII.String(this.primaryTarget));
long start = System.currentTimeMillis();
final String error = yacyClient.transferIndex(target, this.containers, this.references, gzipBody4Transfer, timeout4Transfer);
if (error == null) {
@@ -202,7 +202,7 @@ public class Transmission {
Iterator<ReferenceContainer<WordReference>> i = this.containers.iterator();
ReferenceContainer<WordReference> firstContainer = (i == null) ? null : i.next();
log.logInfo("Index transfer of " + this.containers.size() +
- " words [" + ((firstContainer == null) ? null : UTF8.String(firstContainer.getTermHash())) + " .. " + UTF8.String(this.primaryTarget) + "]" +
+ " words [" + ((firstContainer == null) ? null : ASCII.String(firstContainer.getTermHash())) + " .. " + ASCII.String(this.primaryTarget) + "]" +
" and " + this.references.size() + " URLs" +
" to peer " + target.getName() + ":" + target.hash +
" in " + (transferTime / 1000) +
diff --git a/source/de/anomic/yacy/dht/VerticalWordPartitionScheme.java b/source/de/anomic/yacy/dht/VerticalWordPartitionScheme.java
index 222e1d177..6c7bc5705 100755
--- a/source/de/anomic/yacy/dht/VerticalWordPartitionScheme.java
+++ b/source/de/anomic/yacy/dht/VerticalWordPartitionScheme.java
@@ -25,6 +25,7 @@
package de.anomic.yacy.dht;
+import net.yacy.cora.document.ASCII;
import net.yacy.cora.document.UTF8;
import de.anomic.yacy.yacySeed;
@@ -69,7 +70,7 @@ public class VerticalWordPartitionScheme implements PartitionScheme {
// in case that the partitionExpoent is 1, only one bit is taken from the urlHash,
// which means that the partition is in two parts.
// With partitionExponent = 2 it is divided in four parts and so on.
- return (FlatWordPartitionScheme.std.dhtPosition(wordHash, null) & partitionMask) | (FlatWordPartitionScheme.std.dhtPosition(UTF8.getBytes(urlHash), null) & ~partitionMask);
+ return (FlatWordPartitionScheme.std.dhtPosition(wordHash, null) & partitionMask) | (FlatWordPartitionScheme.std.dhtPosition(ASCII.getBytes(urlHash), null) & ~partitionMask);
}
public final long dhtPosition(final byte[] wordHash, final int verticalPosition) {
@@ -108,7 +109,7 @@ public class VerticalWordPartitionScheme implements PartitionScheme {
}
public final long dhtDistance(final byte[] word, final String urlHash, final yacySeed peer) {
- return dhtDistance(word, urlHash, UTF8.getBytes(peer.hash));
+ return dhtDistance(word, urlHash, ASCII.getBytes(peer.hash));
}
private long dhtDistance(final byte[] from, final String urlHash, final byte[] to) {
diff --git a/source/de/anomic/yacy/graphics/NetworkGraph.java b/source/de/anomic/yacy/graphics/NetworkGraph.java
index 8b8d3147c..921a84957 100644
--- a/source/de/anomic/yacy/graphics/NetworkGraph.java
+++ b/source/de/anomic/yacy/graphics/NetworkGraph.java
@@ -33,6 +33,7 @@ import java.awt.image.BufferedImage;
import java.util.Date;
import java.util.Iterator;
+import net.yacy.cora.document.ASCII;
import net.yacy.cora.document.Hit;
import net.yacy.cora.document.UTF8;
import net.yacy.kelondro.logging.Log;
@@ -280,8 +281,8 @@ public class NetworkGraph {
}
private static void drawNetworkPictureDHT(final RasterPlotter img, final int centerX, final int centerY, final int innerradius, final yacySeed mySeed, final yacySeed otherSeed, final String colorLine, final int coronaangle, boolean out) {
- final int angleMy = (int) (360.0 * (((double) FlatWordPartitionScheme.std.dhtPosition(UTF8.getBytes(mySeed.hash), null)) / ((double) Long.MAX_VALUE)));
- final int angleOther = (int) (360.0 * (((double) FlatWordPartitionScheme.std.dhtPosition(UTF8.getBytes(otherSeed.hash), null)) / ((double) Long.MAX_VALUE)));
+ final int angleMy = (int) (360.0 * (((double) FlatWordPartitionScheme.std.dhtPosition(ASCII.getBytes(mySeed.hash), null)) / ((double) Long.MAX_VALUE)));
+ final int angleOther = (int) (360.0 * (((double) FlatWordPartitionScheme.std.dhtPosition(ASCII.getBytes(otherSeed.hash), null)) / ((double) Long.MAX_VALUE)));
// draw line
img.arcLine(centerX, centerY, innerradius, innerradius - 20, angleMy, !out,
colorLine, null, 12, (coronaangle < 0) ? -1 : coronaangle / 30, 2, true);
@@ -300,7 +301,7 @@ public class NetworkGraph {
final String name = seed.getName().toUpperCase() /*+ ":" + seed.hash + ":" + (((double) ((int) (100 * (((double) yacySeed.dhtPosition(seed.hash)) / ((double) yacySeed.maxDHTDistance))))) / 100.0)*/;
if (name.length() < shortestName) shortestName = name.length();
if (name.length() > longestName) longestName = name.length();
- final int angle = (int) (360.0 * (((double) FlatWordPartitionScheme.std.dhtPosition(UTF8.getBytes(seed.hash), null)) / ((double) Long.MAX_VALUE)));
+ final int angle = (int) (360.0 * (((double) FlatWordPartitionScheme.std.dhtPosition(ASCII.getBytes(seed.hash), null)) / ((double) Long.MAX_VALUE)));
//System.out.println("Seed " + seed.hash + " has distance " + seed.dhtDistance() + ", angle = " + angle);
int linelength = 20 + outerradius * (20 * (name.length() - shortestName) / (longestName - shortestName) + Math.abs(seed.hash.hashCode() % 20)) / 60;
if (linelength > outerradius) linelength = outerradius;
diff --git a/source/de/anomic/yacy/graphics/WebStructureGraph.java b/source/de/anomic/yacy/graphics/WebStructureGraph.java
index 364a90cb9..1153ce909 100644
--- a/source/de/anomic/yacy/graphics/WebStructureGraph.java
+++ b/source/de/anomic/yacy/graphics/WebStructureGraph.java
@@ -44,6 +44,7 @@ import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;
import net.yacy.cora.date.GenericFormatter;
+import net.yacy.cora.document.ASCII;
import net.yacy.cora.document.MultiProtocolURI;
import net.yacy.cora.document.UTF8;
import net.yacy.document.Condenser;
@@ -169,13 +170,13 @@ public class WebStructureGraph {
private void learnrefs(final leanrefObject lro) {
final StringBuilder cpg = new StringBuilder(240);
assert cpg.length() % 12 == 0 : "cpg.length() = " + cpg.length() + ", cpg = " + cpg.toString();
- final String refhashp = UTF8.String(lro.url.hash(), 6, 6); // ref hash part
+ final String refhashp = ASCII.String(lro.url.hash(), 6, 6); // ref hash part
String nexturlhash;
for (MultiProtocolURI u: lro.globalRefURLs) {
byte[] nexturlhashb = new DigestURI(u).hash();
assert nexturlhashb != null;
if (nexturlhashb != null) {
- nexturlhash = UTF8.String(nexturlhashb);
+ nexturlhash = ASCII.String(nexturlhashb);
assert nexturlhash.length() == 12 : "nexturlhash.length() = " + nexturlhash.length() + ", nexturlhash = " + nexturlhash;
assert !nexturlhash.substring(6).equals(refhashp);
// this is a global link
@@ -322,7 +323,7 @@ public class WebStructureGraph {
private final Row.Entry entry;
public HostReference(final byte[] hostHash, final long modified, final int count) {
- assert (hostHash.length == 6) : "hostHash = " + UTF8.String(hostHash);
+ assert (hostHash.length == 6) : "hostHash = " + ASCII.String(hostHash);
this.entry = hostReferenceFactory.getRow().newEntry();
this.entry.setCol(0, hostHash);
this.entry.setCol(1, MicroDate.microDateDays(modified));
@@ -416,7 +417,7 @@ public class WebStructureGraph {
refloop: for (Map.Entry<String, Integer> refhosthashandcounter: sentry.references.entrySet()) {
term = UTF8.getBytes(refhosthashandcounter.getKey());
try {
- hr = new HostReference(UTF8.getBytes(sentry.hosthash), GenericFormatter.SHORT_DAY_FORMATTER.parse(sentry.date).getTime(), refhosthashandcounter.getValue().intValue());
+ hr = new HostReference(ASCII.getBytes(sentry.hosthash), GenericFormatter.SHORT_DAY_FORMATTER.parse(sentry.date).getTime(), refhosthashandcounter.getValue().intValue());
} catch (ParseException e) {
continue refloop;
}
@@ -507,7 +508,7 @@ public class WebStructureGraph {
}
private void learn(final DigestURI url, final StringBuilder reference /*string of b64(12digits)-hashes*/) {
- final String hosthash = UTF8.String(url.hash(), 6, 6);
+ final String hosthash = ASCII.String(url.hash(), 6, 6);
// parse the new reference string and join it with the stored references
StructureEntry structure = outgoingReferences(hosthash);
diff --git a/source/de/anomic/yacy/yacyClient.java b/source/de/anomic/yacy/yacyClient.java
index dc6e09aa7..48a77ee51 100644
--- a/source/de/anomic/yacy/yacyClient.java
+++ b/source/de/anomic/yacy/yacyClient.java
@@ -60,6 +60,7 @@ import java.util.TreeMap;
import java.util.regex.Pattern;
import net.yacy.migration;
+import net.yacy.cora.document.ASCII;
import net.yacy.cora.document.JSONArray;
import net.yacy.cora.document.JSONException;
import net.yacy.cora.document.JSONObject;
@@ -473,7 +474,7 @@ public final class yacyClient {
final ReferenceContainer<WordReference>[] container = new ReferenceContainer[words];
for (int i = 0; i < words; i++) {
try {
- container[i] = ReferenceContainer.emptyContainer(Segment.wordReferenceFactory, UTF8.getBytes(wordhashes.substring(i * Word.commonHashLength, (i + 1) * Word.commonHashLength)), count);
+ container[i] = ReferenceContainer.emptyContainer(Segment.wordReferenceFactory, ASCII.getBytes(wordhashes.substring(i * Word.commonHashLength, (i + 1) * Word.commonHashLength)), count);
} catch (RowSpaceExceededException e) {
Log.logException(e);
return -1;
@@ -484,7 +485,7 @@ public final class yacyClient {
for (URIMetadataRow urlEntry: result.links) {
// get one single search result
if (urlEntry == null) continue;
- assert (urlEntry.hash().length == 12) : "urlEntry.hash() = " + UTF8.String(urlEntry.hash());
+ assert (urlEntry.hash().length == 12) : "urlEntry.hash() = " + ASCII.String(urlEntry.hash());
if (urlEntry.hash().length != 12) continue; // bad url hash
final URIMetadataRow.Components metadata = urlEntry.metadata();
if (metadata == null) continue;
@@ -508,7 +509,7 @@ public final class yacyClient {
// the search-result-url transports all the attributes of word indexes
if (!Base64Order.enhancedCoder.equal(entry.urlhash(), urlEntry.hash())) {
- yacyCore.log.logInfo("remote search: url-hash " + UTF8.String(urlEntry.hash()) + " does not belong to word-attached-hash " + UTF8.String(entry.urlhash()) + "; url = " + metadata.url() + " from peer " + target.getName());
+ yacyCore.log.logInfo("remote search: url-hash " + ASCII.String(urlEntry.hash()) + " does not belong to word-attached-hash " + ASCII.String(entry.urlhash()) + "; url = " + metadata.url() + " from peer " + target.getName());
continue; // spammed
}
@@ -526,7 +527,7 @@ public final class yacyClient {
// because they are search-specific.
// instead, they are placed in a snipped-search cache.
// System.out.println("--- RECEIVED SNIPPET '" + urlEntry.snippet() + "'");
- TextSnippet.snippetsCache.put(wordhashes, UTF8.String(urlEntry.hash()), urlEntry.snippet());
+ TextSnippet.snippetsCache.put(wordhashes, ASCII.String(urlEntry.hash()), urlEntry.snippet());
}
// add the url entry to the word indexes
@@ -575,7 +576,7 @@ public final class yacyClient {
for (Map.Entry<byte[], String> abstractEntry: result.indexabstract.entrySet()) {
try {
ci = new ByteBuffer(abstractEntry.getValue());
- wordhash = UTF8.String(abstractEntry.getKey());
+ wordhash = ASCII.String(abstractEntry.getKey());
} catch (OutOfMemoryError e) {
Log.logException(e);
continue;
@@ -812,7 +813,7 @@ public final class yacyClient {
// prepare request
final Map<String,ContentBody> parts = yacyNetwork.basicRequestParts(Switchboard.getSwitchboard(), target.hash, salt);
parts.put("process", UTF8.StringBody(process));
- parts.put("urlhash", UTF8.StringBody(((entry == null) ? "" : UTF8.String(entry.hash()))));
+ parts.put("urlhash", UTF8.StringBody(((entry == null) ? "" : ASCII.String(entry.hash()))));
parts.put("result", UTF8.StringBody(result));
parts.put("reason", UTF8.StringBody(reason));
parts.put("wordh", UTF8.StringBody(wordhashes));
@@ -854,7 +855,7 @@ public final class yacyClient {
while (eenum.hasNext()) {
entry = eenum.next();
if (urlCache.get(entry.urlhash()) == null) {
- if (yacyCore.log.isFine()) yacyCore.log.logFine("DEBUG transferIndex: to-send url hash '" + UTF8.String(entry.urlhash()) + "' is not contained in urlCache");
+ if (yacyCore.log.isFine()) yacyCore.log.logFine("DEBUG transferIndex: to-send url hash '" + ASCII.String(entry.urlhash()) + "' is not contained in urlCache");
}
}
}
@@ -891,7 +892,7 @@ public final class yacyClient {
// extract the urlCache from the result
final URIMetadataRow[] urls = new URIMetadataRow[uhs.length];
for (int i = 0; i < uhs.length; i++) {
- urls[i] = urlCache.get(UTF8.getBytes(uhs[i]));
+ urls[i] = urlCache.get(ASCII.getBytes(uhs[i]));
if (urls[i] == null) {
if (yacyCore.log.isFine()) yacyCore.log.logFine("DEBUG transferIndex: requested url hash '" + uhs[i] + "', unknownURL='" + uhss + "'");
}
@@ -940,7 +941,7 @@ public final class yacyClient {
eenum = ic.entries();
while (eenum.hasNext()) {
entry = eenum.next();
- entrypost.append(UTF8.String(ic.getTermHash()))
+ entrypost.append(ASCII.String(ic.getTermHash()))
.append(entry.toPropertyForm())
.append(serverCore.CRLF_STRING);
indexcount++;
@@ -1124,14 +1125,14 @@ public final class yacyClient {
searchlines.add(args[2]);
}
for (final String line: searchlines) {
- final byte[] wordhashe = UTF8.getBytes(QueryParams.hashSet2hashString(Word.words2hashesHandles(QueryParams.cleanQuery(line)[0])));
+ final byte[] wordhashe = ASCII.getBytes(QueryParams.hashSet2hashString(Word.words2hashesHandles(QueryParams.cleanQuery(line)[0])));
long time = System.currentTimeMillis();
SearchResult result;
try {
result = new SearchResult(
yacyNetwork.basicRequestParts((String) null, (String) null, "freeworld"),
null, // sb.peers.mySeed(),
- UTF8.String(wordhashe),
+ ASCII.String(wordhashe),
"", // excludehashes,
"", // urlhashes,
QueryParams.matchnothing_pattern, // prefer,
diff --git a/source/de/anomic/yacy/yacyCore.java b/source/de/anomic/yacy/yacyCore.java
index 2b23856ce..440ab71e5 100644
--- a/source/de/anomic/yacy/yacyCore.java
+++ b/source/de/anomic/yacy/yacyCore.java
@@ -50,9 +50,9 @@ import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.Semaphore;
import net.yacy.cora.date.GenericFormatter;
+import net.yacy.cora.document.ASCII;
import net.yacy.cora.document.RSSFeed;
import net.yacy.cora.document.RSSMessage;
-import net.yacy.cora.document.UTF8;
import net.yacy.kelondro.data.meta.DigestURI;
import net.yacy.kelondro.logging.Log;
import de.anomic.search.Switchboard;
@@ -321,7 +321,7 @@ public class yacyCore {
yacySeed seed;
while (i.hasNext()) {
entry = i.next();
- hash = UTF8.String(entry.getKey());
+ hash = ASCII.String(entry.getKey());
seed = seeds.get(hash);
if (seed == null) {
seed = sb.peers.get(hash);
diff --git a/source/de/anomic/yacy/yacyPeerActions.java b/source/de/anomic/yacy/yacyPeerActions.java
index 57813f3b1..f214a6da3 100644
--- a/source/de/anomic/yacy/yacyPeerActions.java
+++ b/source/de/anomic/yacy/yacyPeerActions.java
@@ -27,8 +27,8 @@ package de.anomic.yacy;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
+import net.yacy.cora.document.ASCII;
import net.yacy.cora.document.RSSMessage;
-import net.yacy.cora.document.UTF8;
import net.yacy.kelondro.logging.Log;
import net.yacy.kelondro.util.MapTools;
@@ -206,7 +206,7 @@ public class yacyPeerActions {
// we do this if we did not get contact with the other peer
if (yacyCore.log.isFine()) yacyCore.log.logFine("connect: no contact to a " + peer.get(yacySeed.PEERTYPE, yacySeed.PEERTYPE_VIRGIN) + " peer '" + peer.getName() + "' at " + peer.getPublicAddress() + ". Cause: " + cause);
synchronized (seedDB) {
- if (!seedDB.hasDisconnected(UTF8.getBytes(peer.hash))) { disconnects++; }
+ if (!seedDB.hasDisconnected(ASCII.getBytes(peer.hash))) { disconnects++; }
peer.put("dct", Long.toString(System.currentTimeMillis()));
seedDB.addDisconnected(peer); // update info
}
diff --git a/source/de/anomic/yacy/yacySearch.java b/source/de/anomic/yacy/yacySearch.java
index dd7be2651..87843389d 100644
--- a/source/de/anomic/yacy/yacySearch.java
+++ b/source/de/anomic/yacy/yacySearch.java
@@ -28,7 +28,7 @@ import java.util.Iterator;
import java.util.SortedMap;
import java.util.regex.Pattern;
-import net.yacy.cora.document.UTF8;
+import net.yacy.cora.document.ASCII;
import net.yacy.kelondro.index.HandleSet;
import net.yacy.kelondro.logging.Log;
import net.yacy.kelondro.order.Bitfield;
@@ -137,7 +137,7 @@ public class yacySearch extends Thread {
public static String set2string(final HandleSet hashes) {
StringBuilder wh = new StringBuilder(hashes.size() * 12);
final Iterator<byte[]> iter = hashes.iterator();
- while (iter.hasNext()) { wh.append(UTF8.String(iter.next())); }
+ while (iter.hasNext()) { wh.append(ASCII.String(iter.next())); }
return wh.toString();
}
@@ -225,7 +225,7 @@ public class yacySearch extends Thread {
// prepare seed targets and threads
final yacySeed targetPeer = peers.getConnected(targethash);
if (targetPeer == null || targetPeer.hash == null) return null;
- if (clusterselection != null) targetPeer.setAlternativeAddress(clusterselection.get(UTF8.getBytes(targetPeer.hash)));
+ if (clusterselection != null) targetPeer.setAlternativeAddress(clusterselection.get(ASCII.getBytes(targetPeer.hash)));
final yacySearch searchThread = new yacySearch(
wordhashes, "", urlhashes, QueryParams.matchnothing_pattern, QueryParams.catchall_pattern, QueryParams.catchall_pattern, "", "", "", 20, time, 9999, true, 0, targetPeer,
indexSegment, peers, containerCache, null, blacklist, rankingProfile, constraint);
diff --git a/source/de/anomic/yacy/yacySeed.java b/source/de/anomic/yacy/yacySeed.java
index ce40aed9b..8df2f9d9a 100644
--- a/source/de/anomic/yacy/yacySeed.java
+++ b/source/de/anomic/yacy/yacySeed.java
@@ -62,6 +62,7 @@ import java.util.regex.Pattern;
import net.yacy.cora.date.AbstractFormatter;
import net.yacy.cora.date.GenericFormatter;
+import net.yacy.cora.document.ASCII;
import net.yacy.cora.document.UTF8;
import net.yacy.cora.protocol.Domains;
import net.yacy.kelondro.data.word.Word;
@@ -701,8 +702,8 @@ public class yacySeed implements Cloneable, Comparable<yacySeed>, Comparator<yac
if (interval == null) return randomHash();
// find dht position and size of gap
- long left = FlatWordPartitionScheme.std.dhtPosition(UTF8.getBytes(interval.substring(0, 12)), null);
- long right = FlatWordPartitionScheme.std.dhtPosition(UTF8.getBytes(interval.substring(12)), null);
+ long left = FlatWordPartitionScheme.std.dhtPosition(ASCII.getBytes(interval.substring(0, 12)), null);
+ long right = FlatWordPartitionScheme.std.dhtPosition(ASCII.getBytes(interval.substring(12)), null);
final long gap8 = FlatWordPartitionScheme.dhtDistance(left, right) >> 3; // 1/8 of a gap
long gapx = gap8 + (Math.abs(random.nextLong()) % (6 * gap8));
long gappos = (Long.MAX_VALUE - left >= gapx) ? left + gapx : (left - Long.MAX_VALUE) + gapx;
@@ -737,16 +738,16 @@ public class yacySeed implements Cloneable, Comparable<yacySeed>, Comparator<yac
continue;
}
l = FlatWordPartitionScheme.dhtDistance(
- FlatWordPartitionScheme.std.dhtPosition(UTF8.getBytes(s0.hash), null),
- FlatWordPartitionScheme.std.dhtPosition(UTF8.getBytes(s1.hash), null));
+ FlatWordPartitionScheme.std.dhtPosition(ASCII.getBytes(s0.hash), null),
+ FlatWordPartitionScheme.std.dhtPosition(ASCII.getBytes(s1.hash), null));
gaps.put(l, s0.hash + s1.hash);
s0 = s1;
}
// compute also the last gap
if ((first != null) && (s0 != null)) {
l = FlatWordPartitionScheme.dhtDistance(
- FlatWordPartitionScheme.std.dhtPosition(UTF8.getBytes(s0.hash), null),
- FlatWordPartitionScheme.std.dhtPosition(UTF8.getBytes(first.hash), null));
+ FlatWordPartitionScheme.std.dhtPosition(ASCII.getBytes(s0.hash), null),
+ FlatWordPartitionScheme.std.dhtPosition(ASCII.getBytes(first.hash), null));
gaps.put(l, s0.hash + first.hash);
}
return gaps;
@@ -760,7 +761,7 @@ public class yacySeed implements Cloneable, Comparable<yacySeed>, Comparator<yac
// generate a seed for the local peer
// this is the birthplace of a seed, that then will start to travel to other peers
- final String hashs = UTF8.String(bestGap(db));
+ final String hashs = ASCII.String(bestGap(db));
yacyCore.log.logInfo("init: OWN SEED = " + hashs);
final yacySeed newSeed = new yacySeed(hashs);
@@ -777,7 +778,7 @@ public class yacySeed implements Cloneable, Comparable<yacySeed>, Comparator<yac
final String hash =
Base64Order.enhancedCoder.encode(Digest.encodeMD5Raw(Long.toString(random.nextLong()))).substring(0, 6) +
Base64Order.enhancedCoder.encode(Digest.encodeMD5Raw(Long.toString(random.nextLong()))).substring(0, 6);
- return UTF8.getBytes(hash);
+ return ASCII.getBytes(hash);
}
public static yacySeed genRemoteSeed(final String seedStr, final String key, final boolean ownSeed, String patchIP) throws IOException {
diff --git a/source/de/anomic/yacy/yacySeedDB.java b/source/de/anomic/yacy/yacySeedDB.java
index 47495cbe1..aeb895b1c 100644
--- a/source/de/anomic/yacy/yacySeedDB.java
+++ b/source/de/anomic/yacy/yacySeedDB.java
@@ -40,6 +40,7 @@ import java.util.Set;
import java.util.TreeMap;
import java.util.concurrent.ConcurrentHashMap;
+import net.yacy.cora.document.ASCII;
import net.yacy.cora.document.UTF8;
import net.yacy.cora.protocol.ClientIdentification;
import net.yacy.cora.protocol.Domains;
@@ -298,9 +299,10 @@ public final class yacySeedDB implements AlternativeDomainNames {
if (seedActiveDB.isEmpty() && seedPassiveDB.isEmpty() && seedPotentialDB.isEmpty()) return; // avoid that the own seed is initialized too early
if (this.mySeed == null) initMySeed();
try {
- seedActiveDB.delete(UTF8.getBytes(mySeed.hash));
- seedPassiveDB.delete(UTF8.getBytes(mySeed.hash));
- seedPotentialDB.delete(UTF8.getBytes(mySeed.hash));
+ byte[] mySeedHash = ASCII.getBytes(mySeed.hash);
+ seedActiveDB.delete(mySeedHash);
+ seedPassiveDB.delete(mySeedHash);
+ seedPotentialDB.delete(mySeedHash);
} catch (final IOException e) { Log.logWarning("yacySeedDB", "could not remove hash ("+ e.getClass() +"): "+ e.getMessage()); }
}
@@ -406,7 +408,7 @@ public final class yacySeedDB implements AlternativeDomainNames {
if (seed == null) {
yacyCore.log.logWarning("cluster peer '" + yacydom + "' was not found.");
} else {
- clustermap.put(UTF8.getBytes(hash), ipport);
+ clustermap.put(ASCII.getBytes(hash), ipport);
}
} else if (yacydom.endsWith(".yacy")) {
// find a peer with its name
@@ -414,7 +416,7 @@ public final class yacySeedDB implements AlternativeDomainNames {
if (seed == null) {
yacyCore.log.logWarning("cluster peer '" + yacydom + "' was not found.");
} else {
- clustermap.put(UTF8.getBytes(seed.hash), ipport);
+ clustermap.put(ASCII.getBytes(seed.hash), ipport);
}
} else {
yacyCore.log.logWarning("cluster peer '" + addresses[i] + "' has wrong syntax. the name must end with .yacy or .yacyh");
@@ -499,10 +501,10 @@ public final class yacySeedDB implements AlternativeDomainNames {
nameLookupCache.put(seed.getName(), seed.hash);
final Map<String, String> seedPropMap = seed.getMap();
synchronized (seedPropMap) {
- seedActiveDB.insert(UTF8.getBytes(seed.hash), seedPropMap);
+ seedActiveDB.insert(ASCII.getBytes(seed.hash), seedPropMap);
}
- seedPassiveDB.delete(UTF8.getBytes(seed.hash));
- seedPotentialDB.delete(UTF8.getBytes(seed.hash));
+ seedPassiveDB.delete(ASCII.getBytes(seed.hash));
+ seedPotentialDB.delete(ASCII.getBytes(seed.hash));
} catch (final Exception e) {
yacyCore.log.logSevere("ERROR add: seed.db corrupt (" + e.getMessage() + "); resetting seed.db", e);
resetActiveTable();
@@ -513,14 +515,14 @@ public final class yacySeedDB implements AlternativeDomainNames {
if (seed.isProper(false) != null) return;
try {
nameLookupCache.remove(seed.getName());
- seedActiveDB.delete(UTF8.getBytes(seed.hash));
- seedPotentialDB.delete(UTF8.getBytes(seed.hash));
+ seedActiveDB.delete(ASCII.getBytes(seed.hash));
+ seedPotentialDB.delete(ASCII.getBytes(seed.hash));
} catch (final Exception e) { Log.logWarning("yacySeedDB", "could not remove hash ("+ e.getClass() +"): "+ e.getMessage()); }
//seed.put(yacySeed.LASTSEEN, yacyCore.shortFormatter.format(new Date(yacyCore.universalTime())));
try {
final Map<String, String> seedPropMap = seed.getMap();
synchronized (seedPropMap) {
- seedPassiveDB.insert(UTF8.getBytes(seed.hash), seedPropMap);
+ seedPassiveDB.insert(ASCII.getBytes(seed.hash), seedPropMap);
}
} catch (final Exception e) {
yacyCore.log.logSevere("ERROR add: seed.db corrupt (" + e.getMessage() + "); resetting seed.db", e);
@@ -532,14 +534,14 @@ public final class yacySeedDB implements AlternativeDomainNames {
if (seed.isProper(false) != null) return;
try {
nameLookupCache.remove(seed.getName());
- seedActiveDB.delete(UTF8.getBytes(seed.hash));
- seedPassiveDB.delete(UTF8.getBytes(seed.hash));
+ seedActiveDB.delete(ASCII.getBytes(seed.hash));
+ seedPassiveDB.delete(ASCII.getBytes(seed.hash));
} catch (final Exception e) { Log.logWarning("yacySeedDB", "could not remove hash ("+ e.getClass() +"): "+ e.getMessage()); }
//seed.put(yacySeed.LASTSEEN, yacyCore.shortFormatter.format(new Date(yacyCore.universalTime())));
try {
final Map<String, String> seedPropMap = seed.getMap();
synchronized (seedPropMap) {
- seedPotentialDB.insert(UTF8.getBytes(seed.hash), seedPropMap);
+ seedPotentialDB.insert(ASCII.getBytes(seed.hash), seedPropMap);
}
} catch (final Exception e) {
yacyCore.log.logSevere("ERROR add: seed.db corrupt (" + e.getMessage() + "); resetting seed.db", e);
@@ -550,14 +552,14 @@ public final class yacySeedDB implements AlternativeDomainNames {
public synchronized void removeDisconnected(final String peerHash) {
if(peerHash == null) return;
try {
- seedPassiveDB.delete(UTF8.getBytes(peerHash));
+ seedPassiveDB.delete(ASCII.getBytes(peerHash));
} catch (final IOException e) { Log.logWarning("yacySeedDB", "could not remove hash ("+ e.getClass() +"): "+ e.getMessage()); }
}
public synchronized void removePotential(final String peerHash) {
if(peerHash == null) return;
try {
- seedPotentialDB.delete(UTF8.getBytes(peerHash));
+ seedPotentialDB.delete(ASCII.getBytes(peerHash));
} catch (final IOException e) { Log.logWarning("yacySeedDB", "could not remove hash ("+ e.getClass() +"): "+ e.getMessage()); }
}
@@ -578,7 +580,7 @@ public final class yacySeedDB implements AlternativeDomainNames {
if ((this.mySeed != null) && (hash.equals(mySeed.hash))) return mySeed;
ConcurrentHashMap<String, String> entry = new ConcurrentHashMap<String, String>();
try {
- Map<String, String> map = database.get(UTF8.getBytes(hash));
+ Map<String, String> map = database.get(ASCII.getBytes(hash));
if (map == null) return null;
entry.putAll(map);
} catch (final IOException e) {
@@ -616,15 +618,15 @@ public final class yacySeedDB implements AlternativeDomainNames {
mySeed = seed;
return;
}
-
+ byte[] hashb = ASCII.getBytes(hash);
yacySeed s = get(hash, seedActiveDB);
- if (s != null) try { seedActiveDB.insert(UTF8.getBytes(hash), seed.getMap()); return;} catch (final Exception e) {Log.logException(e);}
+ if (s != null) try { seedActiveDB.insert(hashb, seed.getMap()); return;} catch (final Exception e) {Log.logException(e);}
s = get(hash, seedPassiveDB);
- if (s != null) try { seedPassiveDB.insert(UTF8.getBytes(hash), seed.getMap()); return;} catch (final Exception e) {Log.logException(e);}
+ if (s != null) try { seedPassiveDB.insert(hashb, seed.getMap()); return;} catch (final Exception e) {Log.logException(e);}
s = get(hash, seedPotentialDB);
- if (s != null) try { seedPotentialDB.insert(UTF8.getBytes(hash), seed.getMap()); return;} catch (final Exception e) {Log.logException(e);}
+ if (s != null) try { seedPotentialDB.insert(hashb, seed.getMap()); return;} catch (final Exception e) {Log.logException(e);}
}
public yacySeed lookupByName(String peerName) {
@@ -705,7 +707,7 @@ public final class yacySeedDB implements AlternativeDomainNames {
if (addressStr == null) {
Log.logWarning("YACY","lookupByIP/Connected: address of seed " + seed.getName() + "/" + seed.hash + " is null.");
try {
- badPeerHashes.put(UTF8.getBytes(seed.hash));
+ badPeerHashes.put(ASCII.getBytes(seed.hash));
} catch (RowSpaceExceededException e1) {
Log.logException(e1);
break;
diff --git a/source/net/yacy/cora/document/ASCIIComparator.java b/source/net/yacy/cora/document/ASCII.java
similarity index 57%
rename from source/net/yacy/cora/document/ASCIIComparator.java
rename to source/net/yacy/cora/document/ASCII.java
index 1eded6b8c..caac266c9 100644
--- a/source/net/yacy/cora/document/ASCIIComparator.java
+++ b/source/net/yacy/cora/document/ASCII.java
@@ -35,13 +35,14 @@ import java.util.Comparator;
* Strings without applying .toUpperCase or .toLowerCase
* Strings must contain no other than ASCII code.
*/
-public class ASCIIComparator implements Comparator<String> {
+public class ASCII implements Comparator<String> {
- public static final ASCIIComparator insensitiveASCIIComparator = new ASCIIComparator(true);
+ public static final ASCII insensitiveASCIIComparator = new ASCII(true);
+ public static final ASCII identityASCIIComparator = new ASCII(false);
public boolean insensitive;
- public ASCIIComparator(boolean insensitive) {
+ public ASCII(boolean insensitive) {
this.insensitive = insensitive;
}
@@ -71,6 +72,26 @@ public class ASCIIComparator implements Comparator<String> {
if (l1 > l0) return -1;
return 0;
}
+
+ public boolean equals(String s0, String s1) {
+ if (s0 == null && s1 == null) return true;
+ if (s0 == null) return false;
+ if (s1 == null) return false;
+ int i = 0;
+ int l0 = s0.length(), l1 = s1.length();
+ int lm = Math.min(l0, l1);
+ char c0, c1;
+ while (i < lm) {
+ c0 = s0.charAt(i);
+ c1 = s1.charAt(i);
+ if (this.insensitive && c0 >= 'A' && c0 <='Z') c0 = (char) ((byte) c0 + 32);
+ if (this.insensitive && c1 >= 'A' && c1 <='Z') c1 = (char) ((byte) c1 + 32);
+ if (c0 != c1) return false;
+ i++;
+ }
+ if (l0 != l1) return false;
+ return true;
+ }
@Override
public boolean equals(Object obj) {
@@ -81,5 +102,31 @@ public class ASCIIComparator implements Comparator<String> {
public int hashCode() {
return System.identityHashCode(this);
}
-
+
+ public final static String String(final byte[] bytes) {
+ StringBuilder sb = new StringBuilder(bytes.length);
+ for (int i = 0; i < bytes.length; ++ i) {
+ if (bytes[i] < 0) throw new IllegalArgumentException();
+ sb.append((char) bytes[i]);
+ }
+ return sb.toString();
+ }
+
+ public final static String String(final byte[] bytes, final int offset, final int length) {
+ int l = Math.min(length, bytes.length - offset);
+ StringBuilder sb = new StringBuilder(l);
+ for (int i = 0; i < l; ++ i) {
+ if (bytes[i + offset] < 0) throw new IllegalArgumentException();
+ sb.append((char) bytes[i + offset]);
+ }
+ return sb.toString();
+ }
+
+ public final static byte[] getBytes(final String s) {
+ final byte[] b = new byte[s.length()];
+ for (int i = 0; i < s.length(); i++) {
+ b[i] = (byte) s.charAt(i);
+ }
+ return b;
+ }
}
\ No newline at end of file
diff --git a/source/net/yacy/cora/protocol/HeaderFramework.java b/source/net/yacy/cora/protocol/HeaderFramework.java
index 07fc48547..6d13d3d70 100644
--- a/source/net/yacy/cora/protocol/HeaderFramework.java
+++ b/source/net/yacy/cora/protocol/HeaderFramework.java
@@ -39,7 +39,7 @@ import java.util.TreeMap;
import java.util.Vector;
import java.util.concurrent.ConcurrentHashMap;
-import net.yacy.cora.document.ASCIIComparator;
+import net.yacy.cora.document.ASCII;
import net.yacy.cora.document.MultiProtocolURI;
import net.yacy.cora.document.UTF8;
@@ -224,13 +224,13 @@ public class HeaderFramework extends TreeMap<String, String> implements Map<Stri
// 'proper' appearance, a translation cache is needed.
// upon instantiation, such a mapping cache can be handed over
// If the reverseMappingCache is null, none is used
- super(ASCIIComparator.insensitiveASCIIComparator);
+ super(ASCII.insensitiveASCIIComparator);
this.reverseMappingCache = reverseMappingCache;
}
public HeaderFramework(final Map<String, String> reverseMappingCache, final Map<String, String> othermap) {
// creates a case insensitive map from another map
- super(ASCIIComparator.insensitiveASCIIComparator);
+ super(ASCII.insensitiveASCIIComparator);
this.reverseMappingCache = reverseMappingCache;
// load with data
diff --git a/source/net/yacy/cora/services/federated/solr/SolrSingleConnector.java b/source/net/yacy/cora/services/federated/solr/SolrSingleConnector.java
index 4b176bbd4..82e549c28 100644
--- a/source/net/yacy/cora/services/federated/solr/SolrSingleConnector.java
+++ b/source/net/yacy/cora/services/federated/solr/SolrSingleConnector.java
@@ -42,7 +42,7 @@ import org.apache.solr.client.solrj.response.QueryResponse;
import org.apache.solr.common.SolrDocumentList;
import org.apache.solr.common.SolrInputDocument;
-import net.yacy.cora.document.UTF8;
+import net.yacy.cora.document.ASCII;
import net.yacy.cora.protocol.Domains;
import net.yacy.cora.protocol.ResponseHeader;
import net.yacy.document.Document;
@@ -207,7 +207,7 @@ public class SolrSingleConnector {
public void err(DigestURI digestURI, String failReason, int httpstatus) throws IOException {
SolrInputDocument solrdoc = new SolrInputDocument();
- solrdoc.addField("id", UTF8.String(digestURI.hash()));
+ solrdoc.addField("id", ASCII.String(digestURI.hash()));
solrdoc.addField("sku", digestURI.toNormalform(true, false), 3.0f);
InetAddress address = Domains.dnsResolve(digestURI.getHost());
if (address != null) solrdoc.addField("ip_s", address.getHostAddress());
diff --git a/source/net/yacy/dbtest.java b/source/net/yacy/dbtest.java
index 7683f34a9..544f889ca 100644
--- a/source/net/yacy/dbtest.java
+++ b/source/net/yacy/dbtest.java
@@ -23,6 +23,7 @@ import net.yacy.kelondro.order.NaturalOrder;
import net.yacy.kelondro.table.SQLTable;
import net.yacy.kelondro.table.SplitTable;
import net.yacy.kelondro.table.Table;
+import net.yacy.kelondro.util.ByteBuffer;
import net.yacy.kelondro.util.MemoryControl;
import net.yacy.visualization.ChartPlotter;
@@ -72,7 +73,7 @@ public class dbtest {
final String s = UTF8.String(this.value).trim();
if (s.length() == 0) return false;
final long source = Long.parseLong(s);
- return UTF8.String(this.key).equals(UTF8.String(randomHash(source, source)));
+ return ByteBuffer.equals(this.key, randomHash(source, source));
}
public byte[] getKey() {
@@ -334,13 +335,13 @@ public class dbtest {
if (entry == null)
System.out.println("missing value for entry " + UTF8.String(key) + " in test table");
else
- if (!(UTF8.String(entry.getColBytes(1, false)).equals(UTF8.String(key)))) System.out.println("wrong value for entry " + UTF8.String(key) + ": " + UTF8.String(entry.getColBytes(1, false)) + " in test table");
+ if (!ByteBuffer.equals(entry.getColBytes(1, false), key)) System.out.println("wrong value for entry " + UTF8.String(key) + ": " + UTF8.String(entry.getColBytes(1, false)) + " in test table");
if (table_reference != null) {
entry = table_reference.get(key);
if (entry == null)
System.out.println("missing value for entry " + UTF8.String(key) + " in reference table");
else
- if (!(UTF8.String(entry.getColBytes(1, false)).equals(UTF8.String(key)))) System.out.println("wrong value for entry " + UTF8.String(key) + ": " + UTF8.String(entry.getColBytes(1, false)) + " in reference table");
+ if (!ByteBuffer.equals(entry.getColBytes(1, false), key)) System.out.println("wrong value for entry " + UTF8.String(key) + ": " + UTF8.String(entry.getColBytes(1, false)) + " in reference table");
}
if (i % 1000 == 0) {
diff --git a/source/net/yacy/document/Condenser.java b/source/net/yacy/document/Condenser.java
index 9830a5235..bb33ecaf3 100644
--- a/source/net/yacy/document/Condenser.java
+++ b/source/net/yacy/document/Condenser.java
@@ -38,6 +38,7 @@ import java.util.SortedSet;
import java.util.TreeMap;
+import net.yacy.cora.document.ASCII;
import net.yacy.cora.document.MultiProtocolURI;
import net.yacy.cora.document.UTF8;
import net.yacy.document.language.Identificator;
@@ -391,7 +392,7 @@ public final class Condenser {
final String s = p.getProperty("keywords" + i);
final String[] l = s.split(",");
for (int j = 0; j < l.length; j++) {
- sb.append(UTF8.String(Word.word2hash(l[j])));
+ sb.append(ASCII.String(Word.word2hash(l[j])));
}
if (i < 15) sb.append(",\n");
}
diff --git a/source/net/yacy/document/parser/html/ContentTransformer.java b/source/net/yacy/document/parser/html/ContentTransformer.java
index 756c96c51..19a465d75 100644
--- a/source/net/yacy/document/parser/html/ContentTransformer.java
+++ b/source/net/yacy/document/parser/html/ContentTransformer.java
@@ -32,15 +32,15 @@ import java.util.ArrayList;
import java.util.Properties;
import java.util.TreeSet;
-import net.yacy.cora.document.ASCIIComparator;
+import net.yacy.cora.document.ASCII;
import net.yacy.kelondro.io.CharBuffer;
import net.yacy.kelondro.logging.Log;
public class ContentTransformer extends AbstractTransformer implements Transformer {
// statics: for initialization of the HTMLFilterAbstractTransformer
- private static final TreeSet<String> linkTags0 = new TreeSet<String>(ASCIIComparator.insensitiveASCIIComparator);
- private static final TreeSet<String> linkTags1 = new TreeSet<String>(ASCIIComparator.insensitiveASCIIComparator);
+ private static final TreeSet<String> linkTags0 = new TreeSet<String>(ASCII.insensitiveASCIIComparator);
+ private static final TreeSet<String> linkTags1 = new TreeSet<String>(ASCII.insensitiveASCIIComparator);
static {
linkTags0.add("img");
diff --git a/source/net/yacy/document/parser/images/genericImageParser.java b/source/net/yacy/document/parser/images/genericImageParser.java
index 8f1f70a43..f700a5add 100644
--- a/source/net/yacy/document/parser/images/genericImageParser.java
+++ b/source/net/yacy/document/parser/images/genericImageParser.java
@@ -173,7 +173,7 @@ public class genericImageParser extends AbstractParser implements Parser {
if (description == null || description.length() == 0) description = props.get("Copyright Notice");
}
} catch (JpegProcessingException e) {
- Log.logException(e);
+ //Log.logException(e);
// just ignore
}
} else {
diff --git a/source/net/yacy/kelondro/blob/ArrayStack.java b/source/net/yacy/kelondro/blob/ArrayStack.java
index ee8cd0936..68fff00ec 100755
--- a/source/net/yacy/kelondro/blob/ArrayStack.java
+++ b/source/net/yacy/kelondro/blob/ArrayStack.java
@@ -122,8 +122,8 @@ public class ArrayStack implements BLOB {
// init the thread pool for the keeperOf executor service
this.executor = new ThreadPoolExecutor(
Runtime.getRuntime().availableProcessors() + 1,
- Runtime.getRuntime().availableProcessors() + 1, 10,
- TimeUnit.SECONDS,
+ Runtime.getRuntime().availableProcessors() * 4, 100,
+ TimeUnit.MILLISECONDS,
new LinkedBlockingQueue<Runnable>(),
new NamePrefixThreadFactory(prefix));
diff --git a/source/net/yacy/kelondro/blob/BEncodedHeap.java b/source/net/yacy/kelondro/blob/BEncodedHeap.java
index 93f0df744..c8324425e 100644
--- a/source/net/yacy/kelondro/blob/BEncodedHeap.java
+++ b/source/net/yacy/kelondro/blob/BEncodedHeap.java
@@ -36,6 +36,7 @@ import java.util.Set;
import java.util.TreeSet;
import java.util.regex.Pattern;
+import net.yacy.cora.document.ASCII;
import net.yacy.cora.document.UTF8;
import net.yacy.kelondro.index.RowSpaceExceededException;
import net.yacy.kelondro.logging.Log;
@@ -574,7 +575,7 @@ public class BEncodedHeap implements Map<byte[], Map<String, byte[]>>, Iterable<
Iterator<Map.Entry<byte[], Map<String, byte[]>>> i = map.iterator();
while (i.hasNext()) {
Map.Entry<byte[], Map<String, byte[]>> entry = i.next();
- System.out.println(UTF8.String(entry.getKey()) + ": " + entry.getValue());
+ System.out.println(ASCII.String(entry.getKey()) + ": " + entry.getValue());
}
// clean up
map.close();
@@ -590,7 +591,7 @@ public class BEncodedHeap implements Map<byte[], Map<String, byte[]>>, Iterable<
Iterator<Map.Entry<byte[], Map<String, byte[]>>> i = map.iterator();
while (i.hasNext()) {
Map.Entry<byte[], Map<String, byte[]>> entry = i.next();
- System.out.println(UTF8.String(entry.getKey()) + ": " + entry.getValue());
+ System.out.println(ASCII.String(entry.getKey()) + ": " + entry.getValue());
}
map.close();
} catch (IOException e) {
diff --git a/source/net/yacy/kelondro/blob/Compressor.java b/source/net/yacy/kelondro/blob/Compressor.java
index 21f2f1568..bf0999aa4 100644
--- a/source/net/yacy/kelondro/blob/Compressor.java
+++ b/source/net/yacy/kelondro/blob/Compressor.java
@@ -33,13 +33,13 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Map;
+import java.util.TreeMap;
import java.util.concurrent.BlockingQueue;
-import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.zip.GZIPInputStream;
import java.util.zip.GZIPOutputStream;
-import net.yacy.cora.document.UTF8;
+import net.yacy.cora.document.ASCII;
import net.yacy.kelondro.index.RowSpaceExceededException;
import net.yacy.kelondro.logging.Log;
import net.yacy.kelondro.order.ByteOrder;
@@ -54,7 +54,7 @@ public class Compressor implements BLOB {
static byte[] plainMagic = {(byte) 'p', (byte) '|'}; // magic for plain content (no encoding)
private final BLOB backend;
- private Map<String, byte[]> buffer; // entries which are not yet compressed, format is RAW (without magic)
+ private TreeMap<byte[], byte[]> buffer; // entries which are not yet compressed, format is RAW (without magic)
private BlockingQueue<Entity> writeQueue;
private long bufferlength;
private final long maxbufferlength;
@@ -80,14 +80,14 @@ public class Compressor implements BLOB {
this.backend.trim();
}
- private static class Entity implements Map.Entry<String, byte[]> {
- private String key;
+ private static class Entity implements Map.Entry<byte[], byte[]> {
+ private byte[] key;
private byte[] payload;
- public Entity(String key, byte[] payload) {
+ public Entity(byte[] key, byte[] payload) {
this.key = key;
this.payload = payload;
}
- public String getKey() {
+ public byte[] getKey() {
return this.key;
}
@@ -102,7 +102,7 @@ public class Compressor implements BLOB {
}
}
- private final static Entity poisonWorkerEntry = new Entity("poison", null);
+ private final static Entity poisonWorkerEntry = new Entity(ASCII.getBytes("poison"), null);
private class Worker extends Thread {
public Worker() {
@@ -113,7 +113,7 @@ public class Compressor implements BLOB {
try {
while ((entry = writeQueue.take()) != poisonWorkerEntry) {
try {
- Compressor.this.backend.insert(UTF8.getBytes(entry.getKey()), compress(entry.getValue()));
+ Compressor.this.backend.insert(entry.getKey(), compress(entry.getValue()));
} catch (IOException e) {
Log.logException(e);
buffer.put(entry.getKey(), entry.getValue());
@@ -136,7 +136,7 @@ public class Compressor implements BLOB {
}
private void initBuffer() {
- this.buffer = new ConcurrentHashMap<String, byte[]>();
+ this.buffer = new TreeMap<byte[], byte[]>(this.backend.ordering());
this.bufferlength = 0;
}
@@ -160,7 +160,7 @@ public class Compressor implements BLOB {
this.backend.close(writeIDX);
}
- private byte[] compress(byte[] b) {
+ private static byte[] compress(byte[] b) {
int l = b.length;
if (l < 100) return markWithPlainMagic(b);
byte[] bb = compressAddMagic(b);
@@ -168,7 +168,7 @@ public class Compressor implements BLOB {
return bb;
}
- private byte[] compressAddMagic(byte[] b) {
+ private static byte[] compressAddMagic(byte[] b) {
// compress a byte array and add a leading magic for the compression
try {
//System.out.print("/(" + cdr + ")"); // DEBUG
@@ -185,7 +185,7 @@ public class Compressor implements BLOB {
}
}
- private byte[] markWithPlainMagic(byte[] b) {
+ private static byte[] markWithPlainMagic(byte[] b) {
//System.out.print("+"); // DEBUG
byte[] r = new byte[b.length + 2];
r[0] = plainMagic[0];
@@ -194,7 +194,7 @@ public class Compressor implements BLOB {
return r;
}
- private byte[] decompress(byte[] b) {
+ private static byte[] decompress(byte[] b) {
// use a magic in the head of the bytes to identify compression type
if (b == null) return null;
if (ByteArray.startsWith(b, gzipMagic)) {
@@ -234,19 +234,18 @@ public class Compressor implements BLOB {
public byte[] get(byte[] key) throws IOException, RowSpaceExceededException {
// depending on the source of the result, we additionally do entry compression
// because if a document was read once, we think that it will not be retrieved another time again soon
- String keys = UTF8.String(key);
byte[] b = null;
synchronized (this) {
- b = buffer.remove(keys);
+ b = buffer.remove(key);
if (b != null) {
// compress the entry now and put it to the backend
try {
- this.writeQueue.put(new Entity(keys, b));
+ this.writeQueue.put(new Entity(key, b));
this.bufferlength = this.bufferlength - b.length;
return b;
} catch (InterruptedException e) {
Log.logException(e);
- buffer.put(keys, b);
+ buffer.put(key, b);
}
}
@@ -270,9 +269,8 @@ public class Compressor implements BLOB {
}
public boolean containsKey(byte[] key) {
- String keys = UTF8.String(key);
synchronized (this) {
- return this.buffer.containsKey(keys) || this.backend.containsKey(key);
+ return this.buffer.containsKey(key) || this.backend.containsKey(key);
}
}
@@ -290,9 +288,8 @@ public class Compressor implements BLOB {
}
public long length(byte[] key) throws IOException {
- String keys = UTF8.String(key);
synchronized (this) {
- byte[] b = buffer.get(keys);
+ byte[] b = this.buffer.get(key);
if (b != null) return b.length;
try {
b = this.backend.get(key);
@@ -306,7 +303,7 @@ public class Compressor implements BLOB {
}
private int removeFromQueues(byte[] key) {
- byte[] b = buffer.remove(UTF8.String(key));
+ byte[] b = this.buffer.remove(key);
if (b != null) return b.length;
return 0;
}
@@ -331,7 +328,7 @@ public class Compressor implements BLOB {
// they are either written uncompressed to the database
// or compressed later
synchronized (this) {
- this.buffer.put(UTF8.String(key), b);
+ this.buffer.put(key, b);
this.bufferlength += b.length;
}
@@ -367,7 +364,7 @@ public class Compressor implements BLOB {
private boolean flushOne() {
if (this.buffer.isEmpty()) return false;
// depending on process case, write it to the file or compress it to the other queue
- Map.Entry<String, byte[]> entry = this.buffer.entrySet().iterator().next();
+ Map.Entry<byte[], byte[]> entry = this.buffer.entrySet().iterator().next();
this.buffer.remove(entry.getKey());
try {
this.writeQueue.put(new Entity(entry.getKey(), entry.getValue()));
diff --git a/source/net/yacy/kelondro/blob/HeapReader.java b/source/net/yacy/kelondro/blob/HeapReader.java
index d60f6e130..865ba8400 100644
--- a/source/net/yacy/kelondro/blob/HeapReader.java
+++ b/source/net/yacy/kelondro/blob/HeapReader.java
@@ -35,6 +35,7 @@ import java.util.Map;
import java.util.Map.Entry;
import java.util.concurrent.ExecutionException;
+import net.yacy.cora.document.ASCII;
import net.yacy.cora.document.UTF8;
import net.yacy.kelondro.index.HandleMap;
import net.yacy.kelondro.index.RowSpaceExceededException;
@@ -771,7 +772,7 @@ public class HeapReader {
Map.Entry<byte[], byte[]> entry;
while (hr.hasNext()) {
entry = hr.next();
- System.out.println(UTF8.String(entry.getKey()) + ":" + UTF8.String(entry.getValue()));
+ System.out.println(ASCII.String(entry.getKey()) + ":" + UTF8.String(entry.getValue()));
}
} catch (IOException e) {
Log.logException(e);
diff --git a/source/net/yacy/kelondro/data/citation/CitationReferenceRow.java b/source/net/yacy/kelondro/data/citation/CitationReferenceRow.java
index 45020cb52..5eea387e2 100644
--- a/source/net/yacy/kelondro/data/citation/CitationReferenceRow.java
+++ b/source/net/yacy/kelondro/data/citation/CitationReferenceRow.java
@@ -28,6 +28,7 @@ package net.yacy.kelondro.data.citation;
import java.util.Collection;
+import net.yacy.cora.document.ASCII;
import net.yacy.cora.document.UTF8;
import net.yacy.kelondro.data.word.Word;
import net.yacy.kelondro.index.Column;
@@ -83,7 +84,7 @@ public final class CitationReferenceRow implements Reference /*, Cloneable*/ {
final int urlComps, // number of path components
final byte typeofurl // outlinks to same domain
) {
- assert (urlHash.length == 12) : "urlhash = " + UTF8.String(urlHash);
+ assert (urlHash.length == 12) : "urlhash = " + ASCII.String(urlHash);
this.entry = citationRow.newEntry();
final int mddlm = MicroDate.microDateDays(lastmodified);
final int mddct = MicroDate.microDateDays(updatetime);
diff --git a/source/net/yacy/kelondro/data/image/ImageReferenceRow.java b/source/net/yacy/kelondro/data/image/ImageReferenceRow.java
index 4b05a5e52..4ba4039be 100644
--- a/source/net/yacy/kelondro/data/image/ImageReferenceRow.java
+++ b/source/net/yacy/kelondro/data/image/ImageReferenceRow.java
@@ -29,6 +29,7 @@ package net.yacy.kelondro.data.image;
import java.util.ArrayList;
import java.util.Collection;
+import net.yacy.cora.document.ASCII;
import net.yacy.cora.document.UTF8;
import net.yacy.kelondro.data.word.Word;
import net.yacy.kelondro.index.Column;
@@ -160,7 +161,7 @@ public final class ImageReferenceRow extends AbstractReference implements /*Imag
final int outlinksSame, // outlinks to same domain
final int outlinksOther // outlinks to other domain
) {
- assert (urlHash.length == 12) : "urlhash = " + UTF8.String(urlHash);
+ assert (urlHash.length == 12) : "urlhash = " + ASCII.String(urlHash);
this.entry = urlEntryRow.newEntry();
final int mddlm = MicroDate.microDateDays(lastmodified);
final int mddct = MicroDate.microDateDays(updatetime);
diff --git a/source/net/yacy/kelondro/data/meta/DigestURI.java b/source/net/yacy/kelondro/data/meta/DigestURI.java
index a031db2e5..fb3f56a8e 100644
--- a/source/net/yacy/kelondro/data/meta/DigestURI.java
+++ b/source/net/yacy/kelondro/data/meta/DigestURI.java
@@ -31,8 +31,8 @@ import java.io.File;
import java.io.Serializable;
import java.net.MalformedURLException;
+import net.yacy.cora.document.ASCII;
import net.yacy.cora.document.MultiProtocolURI;
-import net.yacy.cora.document.UTF8;
import net.yacy.cora.protocol.Domains;
import net.yacy.kelondro.logging.Log;
import net.yacy.kelondro.order.Base64Order;
@@ -69,7 +69,7 @@ public class DigestURI extends MultiProtocolURI implements Serializable {
Log.logException(e);
return null;
}
- return (url == null) ? null : UTF8.String(url.hash(), 6, 6);
+ return (url == null) ? null : ASCII.String(url.hash(), 6, 6);
}
/**
@@ -223,7 +223,7 @@ public class DigestURI extends MultiProtocolURI implements Serializable {
assert hashs.length() == 12;
// return result hash
- byte[] b = UTF8.getBytes(hashs.toString());
+ byte[] b = ASCII.getBytes(hashs.toString());
assert b.length == 12;
return b;
}
@@ -284,7 +284,7 @@ public class DigestURI extends MultiProtocolURI implements Serializable {
public static final int domLengthEstimation(final byte[] urlHashBytes) {
// generates an estimation of the original domain length
assert (urlHashBytes != null);
- assert (urlHashBytes.length == 12) : "urlhash = " + UTF8.String(urlHashBytes);
+ assert (urlHashBytes.length == 12) : "urlhash = " + ASCII.String(urlHashBytes);
final int flagbyte = Base64Order.enhancedCoder.decodeByte(urlHashBytes[11]);
final int domLengthKey = flagbyte & 3;
switch (domLengthKey) {
@@ -307,7 +307,7 @@ public class DigestURI extends MultiProtocolURI implements Serializable {
public static final int domDomain(final byte[] urlHash) {
// returns the ID of the domain of the domain
assert (urlHash != null);
- assert (urlHash.length == 12 || urlHash.length == 6) : "urlhash = " + UTF8.String(urlHash);
+ assert (urlHash.length == 12 || urlHash.length == 6) : "urlhash = " + ASCII.String(urlHash);
return (Base64Order.enhancedCoder.decodeByte(urlHash[(urlHash.length == 12) ? 11 : 5]) & 28) >> 2;
}
diff --git a/source/net/yacy/kelondro/data/meta/URIMetadataRow.java b/source/net/yacy/kelondro/data/meta/URIMetadataRow.java
index 68f985faa..9e77f7e25 100644
--- a/source/net/yacy/kelondro/data/meta/URIMetadataRow.java
+++ b/source/net/yacy/kelondro/data/meta/URIMetadataRow.java
@@ -34,6 +34,7 @@ import java.util.Properties;
import java.util.regex.Pattern;
import net.yacy.cora.date.GenericFormatter;
+import net.yacy.cora.document.ASCII;
import net.yacy.cora.document.UTF8;
import net.yacy.kelondro.data.word.WordReferenceRow;
import net.yacy.kelondro.data.word.WordReferenceVars;
@@ -212,7 +213,7 @@ public class URIMetadataRow implements URIMetadata {
//System.out.println("DEBUG-ENTRY: prop=" + prop.toString());
DigestURI url;
try {
- url = new DigestURI(crypt.simpleDecode(prop.getProperty("url", ""), null), UTF8.getBytes(prop.getProperty("hash")));
+ url = new DigestURI(crypt.simpleDecode(prop.getProperty("url", ""), null), ASCII.getBytes(prop.getProperty("hash")));
} catch (final MalformedURLException e) {
url = null;
}
@@ -293,7 +294,7 @@ public class URIMetadataRow implements URIMetadata {
GenericFormatter formatter = new GenericFormatter(GenericFormatter.FORMAT_SHORT_DAY, GenericFormatter.time_minute);
try {
- s.append("hash=").append(UTF8.String(hash()));
+ s.append("hash=").append(ASCII.String(hash()));
assert (s.toString().indexOf(0) < 0);
s.append(",url=").append(crypt.simpleEncode(metadata.url().toNormalform(false, true)));
assert (s.toString().indexOf(0) < 0);
@@ -315,7 +316,7 @@ public class URIMetadataRow implements URIMetadata {
assert (s.toString().indexOf(0) < 0);
s.append(",fresh=").append(formatter.format(freshdate()));
assert (s.toString().indexOf(0) < 0);
- s.append(",referrer=").append(referrerHash() == null ? "" : UTF8.String(referrerHash()));
+ s.append(",referrer=").append(referrerHash() == null ? "" : ASCII.String(referrerHash()));
assert (s.toString().indexOf(0) < 0);
s.append(",md5=").append(md5());
assert (s.toString().indexOf(0) < 0);
@@ -506,7 +507,7 @@ public class URIMetadataRow implements URIMetadata {
public Request toBalancerEntry(final String initiatorHash) {
return new Request(
- UTF8.getBytes(initiatorHash),
+ ASCII.getBytes(initiatorHash),
metadata().url(),
referrerHash(),
metadata().dc_title(),
diff --git a/source/net/yacy/kelondro/data/navigation/NavigationReferenceRow.java b/source/net/yacy/kelondro/data/navigation/NavigationReferenceRow.java
index 88b7dd909..1e2abe404 100644
--- a/source/net/yacy/kelondro/data/navigation/NavigationReferenceRow.java
+++ b/source/net/yacy/kelondro/data/navigation/NavigationReferenceRow.java
@@ -28,7 +28,7 @@ package net.yacy.kelondro.data.navigation;
import java.util.Collection;
-import net.yacy.cora.document.UTF8;
+import net.yacy.cora.document.ASCII;
import net.yacy.kelondro.data.word.Word;
import net.yacy.kelondro.index.Column;
import net.yacy.kelondro.index.Row;
@@ -86,10 +86,10 @@ public final class NavigationReferenceRow extends AbstractReference implements N
final int pos,
final byte flags
) {
- assert (termhash.length == 12) : "termhash = " + UTF8.String(termhash);
- assert (refhash.length == 12) : "refhash = " + UTF8.String(refhash);
+ assert (termhash.length == 12) : "termhash = " + ASCII.String(termhash);
+ assert (refhash.length == 12) : "refhash = " + ASCII.String(refhash);
this.entry = navEntryRow.newEntry();
- this.entry.setCol(col_navhash, UTF8.String(termhash) + UTF8.String(refhash));
+ this.entry.setCol(col_navhash, ASCII.String(termhash) + ASCII.String(refhash));
this.entry.setCol(col_count, count);
this.entry.setCol(col_pos, pos);
this.entry.setCol(col_flags, flags);
@@ -123,11 +123,11 @@ public final class NavigationReferenceRow extends AbstractReference implements N
}
public byte[] urlhash() {
- return UTF8.getBytes(navigationHash().substring(12));
+ return ASCII.getBytes(navigationHash().substring(12));
}
public byte[] termHash() {
- return UTF8.getBytes(navigationHash().substring(0, 12));
+ return ASCII.getBytes(navigationHash().substring(0, 12));
}
public int hitcount() {
diff --git a/source/net/yacy/kelondro/data/navigation/NavigationReferenceVars.java b/source/net/yacy/kelondro/data/navigation/NavigationReferenceVars.java
index 07aae0ab4..d9137db3b 100644
--- a/source/net/yacy/kelondro/data/navigation/NavigationReferenceVars.java
+++ b/source/net/yacy/kelondro/data/navigation/NavigationReferenceVars.java
@@ -28,7 +28,7 @@ package net.yacy.kelondro.data.navigation;
import java.util.Collection;
-import net.yacy.cora.document.UTF8;
+import net.yacy.cora.document.ASCII;
import net.yacy.kelondro.index.Row.Entry;
import net.yacy.kelondro.rwi.AbstractReference;
import net.yacy.kelondro.rwi.Reference;
@@ -91,7 +91,7 @@ public class NavigationReferenceVars extends AbstractReference implements Navig
}
public String navigationHash() {
- return UTF8.String(this.termhash) + UTF8.String(this.refhash);
+ return ASCII.String(this.termhash) + ASCII.String(this.refhash);
}
public byte[] urlhash() {
diff --git a/source/net/yacy/kelondro/data/word/WordReferenceFactory.java b/source/net/yacy/kelondro/data/word/WordReferenceFactory.java
index 6104d7a4d..45800dd34 100644
--- a/source/net/yacy/kelondro/data/word/WordReferenceFactory.java
+++ b/source/net/yacy/kelondro/data/word/WordReferenceFactory.java
@@ -30,7 +30,7 @@ import java.util.Iterator;
import java.util.Map;
import java.util.TreeMap;
-import net.yacy.cora.document.UTF8;
+import net.yacy.cora.document.ASCII;
import net.yacy.kelondro.index.Row;
import net.yacy.kelondro.index.Row.Entry;
import net.yacy.kelondro.rwi.ReferenceContainer;
@@ -74,8 +74,8 @@ public class WordReferenceFactory implements ReferenceFactory<WordReference> {
while (i.hasNext()) {
iEntry = i.next();
if ((excludeContainer != null) && (excludeContainer.getReference(iEntry.urlhash()) != null)) continue; // do not include urls that are in excludeContainer
- dom = UTF8.String(iEntry.urlhash(), 6, 6);
- mod = UTF8.String(iEntry.urlhash(), 0, 6);
+ dom = ASCII.String(iEntry.urlhash(), 6, 6);
+ mod = ASCII.String(iEntry.urlhash(), 0, 6);
if ((paths = doms.get(dom)) == null) {
doms.put(dom, new StringBuilder(30).append(mod));
} else {
diff --git a/source/net/yacy/kelondro/data/word/WordReferenceRow.java b/source/net/yacy/kelondro/data/word/WordReferenceRow.java
index 212348f1c..548bfb8b7 100644
--- a/source/net/yacy/kelondro/data/word/WordReferenceRow.java
+++ b/source/net/yacy/kelondro/data/word/WordReferenceRow.java
@@ -29,7 +29,7 @@ package net.yacy.kelondro.data.word;
import java.util.ArrayList;
import java.util.Collection;
-import net.yacy.cora.document.UTF8;
+import net.yacy.cora.document.ASCII;
import net.yacy.kelondro.index.Column;
import net.yacy.kelondro.index.Row;
import net.yacy.kelondro.index.Row.Entry;
@@ -136,7 +136,7 @@ public final class WordReferenceRow extends AbstractReference implements WordRef
final Bitfield flags // attributes to the url and to the word according the url
) {
- assert (urlHash.length == 12) : "urlhash = " + UTF8.String(urlHash);
+ assert (urlHash.length == 12) : "urlhash = " + ASCII.String(urlHash);
this.entry = urlEntryRow.newEntry();
final int mddlm = MicroDate.microDateDays(lastmodified);
final int mddct = MicroDate.microDateDays(updatetime);
@@ -175,7 +175,7 @@ public final class WordReferenceRow extends AbstractReference implements WordRef
final int outlinksSame, // outlinks to same domain
final int outlinksOther // outlinks to other domain
) {
- assert (urlHash.length == 12) : "urlhash = " + UTF8.String(urlHash);
+ assert (urlHash.length == 12) : "urlhash = " + ASCII.String(urlHash);
this.entry = urlEntryRow.newEntry();
final int mddlm = MicroDate.microDateDays(lastmodified);
final int mddct = MicroDate.microDateDays(updatetime);
diff --git a/source/net/yacy/kelondro/index/IndexTest.java b/source/net/yacy/kelondro/index/IndexTest.java
index 068ba8e7d..c0a222e70 100644
--- a/source/net/yacy/kelondro/index/IndexTest.java
+++ b/source/net/yacy/kelondro/index/IndexTest.java
@@ -32,6 +32,7 @@ import java.util.HashMap;
import java.util.Random;
import java.util.TreeMap;
+import net.yacy.cora.document.ASCII;
import net.yacy.cora.document.UTF8;
import net.yacy.kelondro.order.Base64Order;
import net.yacy.kelondro.util.ByteArray;
@@ -49,7 +50,7 @@ public class IndexTest {
// so we construct a generic Hash using two long values
final String s = (Base64Order.enhancedCoder.encodeLongSB(Math.abs(r0), 6).toString() +
Base64Order.enhancedCoder.encodeLongSB(Math.abs(r1), 6).toString());
- return UTF8.getBytes(s);
+ return ASCII.getBytes(s);
}
public static byte[] randomHash(final Random r) {
diff --git a/source/net/yacy/kelondro/index/RowCollection.java b/source/net/yacy/kelondro/index/RowCollection.java
index 5841f18e9..af6398d26 100644
--- a/source/net/yacy/kelondro/index/RowCollection.java
+++ b/source/net/yacy/kelondro/index/RowCollection.java
@@ -39,6 +39,7 @@ import java.util.concurrent.SynchronousQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
+import net.yacy.cora.document.ASCII;
import net.yacy.cora.document.UTF8;
import net.yacy.kelondro.logging.Log;
import net.yacy.kelondro.order.Base64Order;
@@ -241,7 +242,7 @@ public class RowCollection implements Iterable<Row.Entry>, Cloneable {
entry.setCol(exp_chunkcount, this.chunkcount);
entry.setCol(exp_last_read, daysSince2000(System.currentTimeMillis()));
entry.setCol(exp_last_wrote, daysSince2000(this.lastTimeWrote));
- entry.setCol(exp_order_type, (this.rowdef.objectOrder == null) ? UTF8.getBytes("__") : UTF8.getBytes(this.rowdef.objectOrder.signature()));
+ entry.setCol(exp_order_type, (this.rowdef.objectOrder == null) ? ASCII.getBytes("__") : UTF8.getBytes(this.rowdef.objectOrder.signature()));
entry.setCol(exp_order_bound, this.sortBound);
entry.setCol(exp_collection, this.chunkcache);
return entry.bytes();
diff --git a/source/net/yacy/kelondro/index/RowSet.java b/source/net/yacy/kelondro/index/RowSet.java
index 227aa826c..c09b0b19c 100644
--- a/source/net/yacy/kelondro/index/RowSet.java
+++ b/source/net/yacy/kelondro/index/RowSet.java
@@ -30,6 +30,8 @@ import java.util.Iterator;
import java.util.Map;
import java.util.Random;
import java.util.TreeMap;
+
+import net.yacy.cora.document.ASCII;
import net.yacy.cora.document.UTF8;
import net.yacy.kelondro.logging.Log;
import net.yacy.kelondro.order.Base64Order;
@@ -557,7 +559,7 @@ public class RowSet extends RowCollection implements Index, Iterable<Row.Entry>
Row.Entry entry;
while (ii.hasNext()) {
entry = ii.next();
- s = UTF8.String(entry.getPrimaryKeyBytes()).trim();
+ s = ASCII.String(entry.getPrimaryKeyBytes()).trim();
System.out.print(s + ", ");
if (s.equals("drei")) ii.remove();
}
@@ -672,7 +674,7 @@ public class RowSet extends RowCollection implements Index, Iterable<Row.Entry>
public static byte[] randomHash(final long r0, final long r1) {
// a long can have 64 bit, but a 12-byte hash can have 6 * 12 = 72 bits
// so we construct a generic Hash using two long values
- return UTF8.getBytes(
+ return ASCII.getBytes(
Base64Order.enhancedCoder.encodeLongSB(Math.abs(r0), 11).substring(5) +
Base64Order.enhancedCoder.encodeLongSB(Math.abs(r1), 11).substring(5));
}
diff --git a/source/net/yacy/kelondro/order/Base64Order.java b/source/net/yacy/kelondro/order/Base64Order.java
index 71c38736f..ab51717b2 100644
--- a/source/net/yacy/kelondro/order/Base64Order.java
+++ b/source/net/yacy/kelondro/order/Base64Order.java
@@ -29,6 +29,7 @@ package net.yacy.kelondro.order;
import java.util.Comparator;
+import net.yacy.cora.document.ASCII;
import net.yacy.cora.document.UTF8;
import net.yacy.kelondro.index.HandleSet;
import net.yacy.kelondro.index.RowSpaceExceededException;
@@ -252,7 +253,7 @@ public class Base64Order extends AbstractOrder<byte[]> implements ByteOrder, Com
}
if (rfc1113compliant) while (writepos % 4 > 0 && writepos < sublen) out[writepos] = '=';
- assert encode(in).substring(0, sublen).equals(UTF8.String(out));
+ assert encode(in).substring(0, sublen).equals(ASCII.String(out));
return out;
}
diff --git a/source/net/yacy/kelondro/rwi/ReferenceContainer.java b/source/net/yacy/kelondro/rwi/ReferenceContainer.java
index 202172418..405344b2e 100644
--- a/source/net/yacy/kelondro/rwi/ReferenceContainer.java
+++ b/source/net/yacy/kelondro/rwi/ReferenceContainer.java
@@ -32,7 +32,7 @@ import java.util.ConcurrentModificationException;
import java.util.Iterator;
import java.util.TreeMap;
-import net.yacy.cora.document.UTF8;
+import net.yacy.cora.document.ASCII;
import net.yacy.kelondro.index.HandleSet;
import net.yacy.kelondro.index.Row;
import net.yacy.kelondro.index.RowSet;
@@ -366,8 +366,8 @@ public class ReferenceContainer<ReferenceType extends Reference> extends RowSet
ie1 = se.next();
ie2 = large.getReference(ie1.urlhash());
if ((ie1 != null) && (ie2 != null)) {
- assert (ie1.urlhash().length == keylength) : "ie0.urlHash() = " + UTF8.String(ie1.urlhash());
- assert (ie2.urlhash().length == keylength) : "ie1.urlHash() = " + UTF8.String(ie2.urlhash());
+ assert (ie1.urlhash().length == keylength) : "ie0.urlHash() = " + ASCII.String(ie1.urlhash());
+ assert (ie2.urlhash().length == keylength) : "ie1.urlHash() = " + ASCII.String(ie2.urlhash());
// this is a hit. Calculate word distance:
ie1 = factory.produceFast(ie2);
@@ -400,8 +400,8 @@ public class ReferenceContainer<ReferenceType extends Reference> extends RowSet
ie2 = e2.next();
while (true) {
- assert (ie1.urlhash().length == keylength) : "ie1.urlHash() = " + UTF8.String(ie1.urlhash());
- assert (ie2.urlhash().length == keylength) : "ie2.urlHash() = " + UTF8.String(ie2.urlhash());
+ assert (ie1.urlhash().length == keylength) : "ie1.urlHash() = " + ASCII.String(ie1.urlhash());
+ assert (ie2.urlhash().length == keylength) : "ie2.urlHash() = " + ASCII.String(ie2.urlhash());
c = ordering.compare(ie1.urlhash(), ie2.urlhash());
//System.out.println("** '" + ie1.getUrlHash() + "'.compareTo('" + ie2.getUrlHash() + "')="+c);
if (c < 0) {
@@ -456,8 +456,8 @@ public class ReferenceContainer<ReferenceType extends Reference> extends RowSet
ie0 = se.next();
ie1 = excl.getReference(ie0.urlhash());
if ((ie0 != null) && (ie1 != null)) {
- assert (ie0.urlhash().length == keylength) : "ie0.urlHash() = " + UTF8.String(ie0.urlhash());
- assert (ie1.urlhash().length == keylength) : "ie1.urlHash() = " + UTF8.String(ie1.urlhash());
+ assert (ie0.urlhash().length == keylength) : "ie0.urlHash() = " + ASCII.String(ie0.urlhash());
+ assert (ie1.urlhash().length == keylength) : "ie1.urlHash() = " + ASCII.String(ie1.urlhash());
if (iterate_pivot) se.remove(); pivot.delete(ie0.urlhash());
}
}
@@ -482,8 +482,8 @@ public class ReferenceContainer<ReferenceType extends Reference> extends RowSet
ie2 = e2.next();
while (true) {
- assert (ie1.urlhash().length == keylength) : "ie1.urlHash() = " + UTF8.String(ie1.urlhash());
- assert (ie2.urlhash().length == keylength) : "ie2.urlHash() = " + UTF8.String(ie2.urlhash());
+ assert (ie1.urlhash().length == keylength) : "ie1.urlHash() = " + ASCII.String(ie1.urlhash());
+ assert (ie2.urlhash().length == keylength) : "ie2.urlHash() = " + ASCII.String(ie2.urlhash());
c = pivot.rowdef.getOrdering().compare(ie1.urlhash(), ie2.urlhash());
//System.out.println("** '" + ie1.getUrlHash() + "'.compareTo('" + ie2.getUrlHash() + "')="+c);
if (c < 0) {
@@ -504,7 +504,7 @@ public class ReferenceContainer<ReferenceType extends Reference> extends RowSet
}
public synchronized String toString() {
- return "C[" + UTF8.String(termHash) + "] has " + this.size() + " entries";
+ return "C[" + ASCII.String(termHash) + "] has " + this.size() + " entries";
}
public int hashCode() {
diff --git a/source/net/yacy/kelondro/table/SQLTable.java b/source/net/yacy/kelondro/table/SQLTable.java
index dc1ef405e..ea6006ba3 100644
--- a/source/net/yacy/kelondro/table/SQLTable.java
+++ b/source/net/yacy/kelondro/table/SQLTable.java
@@ -39,6 +39,8 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
+
+import net.yacy.cora.document.ASCII;
import net.yacy.cora.document.UTF8;
import net.yacy.kelondro.index.Index;
import net.yacy.kelondro.index.Row;
@@ -178,7 +180,7 @@ public class SQLTable implements Index, Iterable<Row.Entry> {
final String sqlQuery = "SELECT value from test where hash = ?";
final PreparedStatement sqlStatement = this.theDBConnection.prepareStatement(sqlQuery);
- sqlStatement.setString(1, UTF8.String(key));
+ sqlStatement.setString(1, ASCII.String(key));
byte[] value = null;
final ResultSet result = sqlStatement.executeQuery();
diff --git a/source/net/yacy/kelondro/util/FileUtils.java b/source/net/yacy/kelondro/util/FileUtils.java
index 34372a8d8..8bca3ee11 100644
--- a/source/net/yacy/kelondro/util/FileUtils.java
+++ b/source/net/yacy/kelondro/util/FileUtils.java
@@ -511,6 +511,10 @@ public final class FileUtils {
return table(new StringsIterator(br));
}
+
+ //private final static Pattern escaped_equal = Pattern.compile("\\=");
+ //private final static Pattern escaped_newline = Pattern.compile("\\n");
+ //private final static Pattern escaped_backslash = Pattern.compile("\\");
public static ConcurrentHashMap<String, String> table(Iterator<String> li) {
String line;
final ConcurrentHashMap<String, String> props = new ConcurrentHashMap<String, String>();
@@ -523,6 +527,7 @@ public final class FileUtils {
pos = line.indexOf('=', pos+1);
} while ( pos > 0 && line.charAt(pos-1) == '\\');
if (pos > 0) {
+ //String key = escaped_equal.matcher(line.substring(0, pos).trim()).replaceAll("=");
String key = line.substring(0, pos).trim().replace("\\=", "=").replace("\\n", "\n").replace("\\", "\\");
String value = line.substring(pos + 1).trim().replace("\\n", "\n").replace("\\\\", "\\");
props.put(key, value);
diff --git a/source/net/yacy/kelondro/util/MemoryControl.java b/source/net/yacy/kelondro/util/MemoryControl.java
index 767ca83ac..916749376 100644
--- a/source/net/yacy/kelondro/util/MemoryControl.java
+++ b/source/net/yacy/kelondro/util/MemoryControl.java
@@ -170,6 +170,7 @@ public class MemoryControl {
}
public static boolean shortStatus() {
+ if (shortStatus) System.out.println("**** SHORT MEMORY ****");
return shortStatus;
}
diff --git a/source/net/yacy/repository/LoaderDispatcher.java b/source/net/yacy/repository/LoaderDispatcher.java
index 63496e168..f4f0ad751 100644
--- a/source/net/yacy/repository/LoaderDispatcher.java
+++ b/source/net/yacy/repository/LoaderDispatcher.java
@@ -40,6 +40,7 @@ import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.Semaphore;
import java.util.concurrent.TimeUnit;
+import net.yacy.cora.document.ASCII;
import net.yacy.cora.document.MultiProtocolURI;
import net.yacy.cora.document.UTF8;
import net.yacy.cora.protocol.ClientIdentification;
@@ -116,7 +117,7 @@ public final class LoaderDispatcher {
final boolean global
) {
return new Request(
- UTF8.getBytes(sb.peers.mySeed().hash),
+ ASCII.getBytes(sb.peers.mySeed().hash),
url,
null,
"",
diff --git a/source/net/yacy/yacy.java b/source/net/yacy/yacy.java
index aab9ece7b..8fa360820 100644
--- a/source/net/yacy/yacy.java
+++ b/source/net/yacy/yacy.java
@@ -47,7 +47,7 @@ import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
import net.yacy.cora.date.GenericFormatter;
-import net.yacy.cora.document.UTF8;
+import net.yacy.cora.document.ASCII;
import net.yacy.cora.protocol.ClientIdentification;
import net.yacy.cora.protocol.RequestHeader;
import net.yacy.cora.protocol.http.HTTPClient;
@@ -680,7 +680,7 @@ public final class yacy {
}
if (wordCounter%500 == 0) {
- wordChunkEndHash = UTF8.String(wordIdxContainer.getTermHash());
+ wordChunkEndHash = ASCII.String(wordIdxContainer.getTermHash());
wordChunkEnd = System.currentTimeMillis();
final long duration = wordChunkEnd - wordChunkStart;
log.logInfo(wordCounter + " words scanned " +
@@ -848,7 +848,7 @@ public final class yacy {
bos.write(container.getTermHash());
bos.write(serverCore.CRLF);
if (counter % 500 == 0) {
- log.logInfo("Found " + counter + " Hashs until now. Last found Hash: " + UTF8.String(container.getTermHash()));
+ log.logInfo("Found " + counter + " Hashs until now. Last found Hash: " + ASCII.String(container.getTermHash()));
}
}
}
@@ -865,14 +865,14 @@ public final class yacy {
bos.write(container.getTermHash());
bos.write(serverCore.CRLF);
if (counter % 500 == 0) {
- log.logInfo("Found " + counter + " Hashs until now. Last found Hash: " + UTF8.String(container.getTermHash()));
+ log.logInfo("Found " + counter + " Hashs until now. Last found Hash: " + ASCII.String(container.getTermHash()));
}
}
}
bos.flush();
bos.close();
}
- log.logInfo("Total number of Hashs: " + counter + ". Last found Hash: " + (container == null ? "null" : UTF8.String(container.getTermHash())));
+ log.logInfo("Total number of Hashs: " + counter + ". Last found Hash: " + (container == null ? "null" : ASCII.String(container.getTermHash())));
} catch (final IOException e) {
log.logSevere("IOException", e);
}