From 36b898ca7adcfe6417c21578b33a1e72daa2170d Mon Sep 17 00:00:00 2001 From: orbiter Date: Sun, 17 Feb 2008 12:36:43 +0000 Subject: [PATCH] - tested successfully z-presentation of yacy seed encoding - added alternative switch that takes shortest representation as yacy seed string encoding git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@4491 6c8d7289-2bf4-0310-a012-ef5d649a1542 --- source/de/anomic/tools/crypt.java | 6 ++++++ source/de/anomic/yacy/yacySeed.java | 6 +++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/source/de/anomic/tools/crypt.java b/source/de/anomic/tools/crypt.java index 4ae4be66b..2c201583c 100644 --- a/source/de/anomic/tools/crypt.java +++ b/source/de/anomic/tools/crypt.java @@ -129,4 +129,10 @@ public class crypt { } } + public static void main(String[] args) { + String teststring="1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; + System.out.println("Teststring = " + teststring); + System.out.println("enc-b result = " + simpleDecode(simpleEncode(teststring, null, 'b'), null)); + System.out.println("enc-z result = " + simpleDecode(simpleEncode(teststring, null, 'z'), null)); + } } \ No newline at end of file diff --git a/source/de/anomic/yacy/yacySeed.java b/source/de/anomic/yacy/yacySeed.java index 99c23051b..b34731bdc 100644 --- a/source/de/anomic/yacy/yacySeed.java +++ b/source/de/anomic/yacy/yacySeed.java @@ -818,7 +818,11 @@ public class yacySeed { public final String genSeedStr(String key) { // use a default encoding - return this.genSeedStr('z', key); + String z = this.genSeedStr('z', key); + String b = this.genSeedStr('b', key); + // the compressed string may be longer that the uncompressed if there is too much overhead for compression meta-info + // take simply that string that is shorter + if (b.length() < z.length()) return b; else return z; } public final synchronized String genSeedStr(char method, String key) {