How to read a file in Java using Scanner
This tutorial shows how to read a file in Java using Scanner class. The java.util.Scanner can parse text from a variety of input sources like String, File, InputStream, System.in etc. and can break the input into tokens as per the specified delimiter. By default, it uses whitespace as the delimiter.
Validate JSON against Schema in Java
This tutorial shows how to validate JSON against Schema in Java. It presents a utility class – ValidationUtils.java that implements the validation logic. This tutorial uses the open source Jackson 2.x libraries and fge/json-schema-validator libraries hosted on GitHub.
Jackson: Ignore null and empty fields
This article discusses options to ignore null and empty fields during serialization to JSON using Jackson 2.x. By default, Jackson 2.x includes null and empty object fields while serializing to JSON. Sometimes, it is desirable to ignore such fields. You can do that by following any of the following two options: Annotate the class or the fields with […]
List IP addresses in Java
This article explains what a network interface is and presents code to list IP addresses bound to physical interfaces in Java. A computer connects to a network through a connection point called a Network Interface. A network interface can be a physical hardware like your ethernet card or a wireless network card (WiFi module); or […]