Skip to Content
Java: Data Science Made Easy
book

Java: Data Science Made Easy

by Richard M. Reese, Jennifer L. Reese, Alexey Grigorev
July 2017
Beginner to intermediate
715 pages
17h 3m
English
Packt Publishing
Content preview from Java: Data Science Made Easy

Web and HTML

There is a lot of data on the Internet nowadays, and being able to access this data and transform it into something machine-readable is a very important skill for a Data Scientist.

There are multiple ways of accessing data from the Internet. Luckily for us, the standard Java API provides a special class for doing that, URL. With URL, it is possible to open an InputStream, which will contain the response body. For web pages it typically is its HTML content. With IOUtils from Commons IO, doing this is simple:

try (InputStream is = new URL(url).openStream()) {     return IOUtils.toString(is, StandardCharsets.UTF_8); }

This piece of code is quite useful, so putting it into some helper method, for example, UrlUtils.request, will be ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Java Data Science Cookbook

Java Data Science Cookbook

Rushdi Shams
Java for Data Science

Java for Data Science

Walter Molina, Richard M. Reese, Shilpi Saxena, Jennifer L. Reese

Publisher Resources

ISBN: 9781788475655Supplemental Content