final byte[] content = postToFile(target, "idx.json", parts, 30000);
if (content == null || content.length == 0) {
yacyCore.log.logWarning("yacyClient.loadIDXHosts error: empty result");
return null;
}
final JSONObject json = new JSONObject(new JSONTokener(new InputStreamReader(new ByteArrayInputStream(content))));
/* the json has the following form:
{
"version":"#[version]#",
"uptime":"#[uptime]#",
"name":"#[name]#",
"rowdef":"#[rowdef]#",
"idx":{
#{list}#"#[term]#":[#[references]#]#(comma)#::,#(/comma)#
#{/list}#
}
}
*/
final JSONObject idx = json.getJSONObject("idx");
// iterate over all references
final Iterator<String> termIterator = idx.keys();
String term;
while (termIterator.hasNext()) {
term = termIterator.next();
final JSONArray references = idx.getJSONArray(term);
// iterate until we get an exception or null
int c = 0;
String reference;
final ReferenceContainer<HostReference> referenceContainer = new ReferenceContainer<HostReference>(WebStructureGraph.hostReferenceFactory, UTF8.getBytes(term));
try {