isIPv4Address function

Hello,

does the function isIPv4Address check the content of the octets?
what does it return for the following input?

  • 256.1.1.1
  • A.1.1.1

The function isIPv4Address is publically available in SimpleTests.java for you to inspect:

	/**
	 * Helper function to determine if the given host is an instance of {@link IPv4Address}.
	 *
	 * @param host the host
	 * @return {@code true} if the host is an instance of {@link IPv4Address}
	 */
	public boolean isIPv4Address(Host host) {
		return host instanceof IPv4Address;
	}

It even describes its own function: It checks whether the parser created the host as an IPv4Address.

maybe I did not phrase my question correctly enough, sorry.
does the function check for the boundaries? does it return false or true if one or more octets are not a number between 0 and 255?

The binary instanceof operator checks whether an object (first argument) is a subtype of a given type (second argument).
The second argument can also be an interface like in the example above.
A good explanation is provided on StackOverflow.

Important note: The evaluation happens at runtime.

Note: It is often bad style to perform such subtyping checks as there are usually better options. But for our use case here, it is a simple and effective solution.