String s = Bytes.toString(text);
int i = 0;
int j = s.indexOf('&');
while (j >= 0) {
if (j > 0) {
KVPair kv = KVPair.parsePair(s.substring(i, j));
if (kv != null) {
bundle.setValue(format.getField(kv.getKey()), ValueFactory.create(kv.getValue()));
}
}
i = j + 1;
j = s.indexOf('&', i);
}
KVPair kv = KVPair.parsePair(s.substring(i));
if (kv != null) {
bundle.setValue(format.getField(kv.getKey()), ValueFactory.create(kv.getValue()));
}
return bundle;
}