Java Reference
In-Depth Information
Event event = null;
boolean found = false;
String information = "";
//Advance to the contact key
while (parser.hasNext()) {
event = parser.next();
if ((event == Event.KEY_NAME) &&
"contact".equals(parser.getString())) {
found = true;
event = parser.next();
break;
}
}
if (!found) {
return "contact information does not
exist";
}
//get contact information
while (event != Event.END_ARRAY) {
switch (event) {
case KEY_NAME:
information += parser.getString() + " =
";
break;
case START_ARRAY: break;
case END_ARRAY: break;
case VALUE_FALSE: break;
case VALUE_NULL: break;
case VALUE_NUMBER:
if (parser.isIntegralNumber()) {
information += parser.getLong()+", ";
} else {
information +=
parser.getBigDecimal()+", ";
}
Search WWH ::




Custom Search