11.10 Reading Formatted Open Data from a Remote Location

More and more organizations open their data to the general public, and to programmers in particular. In this section, we show how to access data located on a remote server, parse the data, convert the data to a Stream, and process the Stream.

11.10.1 Accessing Remote Data

The city of Baltimore, Maryland, opens a lot of its data to the public. For this example, we have chosen to retrieve and process data on polling places. The data is located at the following Uniform Record Locator (URL):

https://data.baltimorecity.gov/api/views/u7bw-gha5/rows.json?accessType=DOWNLOAD

In order to access the data, we use the URL and Scanner classes. Some of their constructors and methods are listed ...

Get Java Illuminated, 5th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.