json.consume("header");
json.consume(JSONTokeniser.Token.COLON);
headers = new Vector<String>();
json.consumeArray(headers, String.class);
if (headers.size() < 1)
throw new ServalDInterfaceException("empty JSON headers array");
for (int i = 0; i < headers.size(); ++i) {
String header = headers.get(i);
if (header.equals("_id"))
columnIndex__id = i;
else if (header.equals("my_sid"))
columnIndex_my_sid = i;
else if (header.equals("their_sid"))
columnIndex_their_sid = i;
else if (header.equals("read"))
columnIndex_read = i;
else if (header.equals("last_message"))
columnIndex_last_message = i;
else if (header.equals("read_offset"))
columnIndex_read_offset = i;
}
if (columnIndex__id == -1)
throw new ServalDInterfaceException("missing JSON column: _id");
if (columnIndex_my_sid == -1)
throw new ServalDInterfaceException("missing JSON column: my_sid");
if (columnIndex_their_sid == -1)
throw new ServalDInterfaceException("missing JSON column: their_sid");
if (columnIndex_read == -1)
throw new ServalDInterfaceException("missing JSON column: read");
if (columnIndex_last_message == -1)
throw new ServalDInterfaceException("missing JSON column: last_message");
if (columnIndex_read_offset == -1)
throw new ServalDInterfaceException("missing JSON column: read_offset");
json.consume(JSONTokeniser.Token.COMMA);
json.consume("rows");
json.consume(JSONTokeniser.Token.COLON);
json.consume(JSONTokeniser.Token.START_ARRAY);
}
catch (JSONInputException e) {
throw new ServalDInterfaceException(e);
}
}