use of com.revolsys.record.io.format.json.JsonParser.EventType in project com.revolsys.open by revolsys.
the class JsonMapIterator method readNextRecord.
/**
* Reads the next line from the buffer and converts to a string array.
*
* @return a string array with each comma-separated element as a separate
* entry.
* @throws IOException if bad things happen during the read
*/
private MapEx readNextRecord() {
if (this.hasNext && this.parser.hasNext()) {
final EventType event = this.parser.next();
if (event == EventType.endArray || event == EventType.endDocument) {
this.hasNext = false;
close();
return null;
} else {
this.currentObject = this.parser.getMap();
return this.currentObject;
}
} else {
this.hasNext = false;
close();
return null;
}
}
use of com.revolsys.record.io.format.json.JsonParser.EventType in project com.revolsys.open by revolsys.
the class GeoJsonGeometryReader method readPointCoordinatesListList.
private List<LineString> readPointCoordinatesListList() {
if (this.in.getEvent() == EventType.startArray || this.in.hasNext() && this.in.next() == EventType.startArray) {
EventType event = this.in.next();
final List<LineString> coordinatesLists = new ArrayList<>();
if (event != EventType.endArray) {
do {
coordinatesLists.add(readPointCoordinatesList());
event = this.in.next();
} while (event == EventType.comma);
}
if (event != EventType.endArray) {
throw new IllegalStateException("Exepecting end array, not: " + event);
}
return coordinatesLists;
} else {
throw new IllegalStateException("Exepecting start array, not: " + this.in.getEvent());
}
}
use of com.revolsys.record.io.format.json.JsonParser.EventType in project com.revolsys.open by revolsys.
the class GeoJsonGeometryReader method readCoordinatesListList.
private List<LineString> readCoordinatesListList(final boolean cogo, final boolean ring) {
if (this.in.getEvent() == EventType.startArray || this.in.hasNext() && this.in.next() == EventType.startArray) {
EventType event = this.in.next();
final List<LineString> coordinatesLists = new ArrayList<>();
if (event != EventType.endArray) {
do {
coordinatesLists.add(readCoordinatesList(cogo, ring));
event = this.in.next();
} while (event == EventType.comma);
}
if (event != EventType.endArray) {
throw new IllegalStateException("Exepecting end array, not: " + event);
}
return coordinatesLists;
} else {
throw new IllegalStateException("Exepecting start array, not: " + this.in.getEvent());
}
}
use of com.revolsys.record.io.format.json.JsonParser.EventType in project com.revolsys.open by revolsys.
the class GeoJsonGeometryReader method readCoordinatesList.
private int readCoordinatesList(final List<Double> coordinates) {
int axisCount = 0;
if (this.in.getEvent() == EventType.startArray || this.in.hasNext() && this.in.next() == EventType.startArray) {
EventType event = this.in.next();
if (event != EventType.endArray) {
do {
axisCount = Math.max(axisCount, readCoordinatesListCoordinates(coordinates));
event = this.in.next();
} while (event == EventType.comma);
}
if (event != EventType.endArray) {
throw new IllegalStateException("Exepecting end array, not: " + event);
}
} else {
throw new IllegalStateException("Exepecting start array, not: " + this.in.getEvent());
}
return axisCount;
}
use of com.revolsys.record.io.format.json.JsonParser.EventType in project com.revolsys.open by revolsys.
the class GeoJsonGeometryReader method readCoordinatesListListList.
private List<List<LineString>> readCoordinatesListListList(final boolean cogo) {
if (this.in.getEvent() == EventType.startArray || this.in.hasNext() && this.in.next() == EventType.startArray) {
EventType event = this.in.next();
final List<List<LineString>> coordinatesLists = new ArrayList<>();
if (event != EventType.endArray) {
do {
coordinatesLists.add(readCoordinatesListList(cogo, true));
event = this.in.next();
} while (event == EventType.comma);
}
if (event != EventType.endArray) {
throw new IllegalStateException("Exepecting end array, not: " + event);
}
return coordinatesLists;
} else {
throw new IllegalStateException("Exepecting start array, not: " + this.in.getEvent());
}
}
Aggregations