ip-utils

A set of utility classes for working with IP addresses

License

License

GroupId

GroupId

com.github.robtimus
ArtifactId

ArtifactId

ip-utils
Last Version

Last Version

1.3
Release Date

Release Date

Type

Type

jar
Description

Description

ip-utils
A set of utility classes for working with IP addresses
Project URL

Project URL

https://robtimus.github.io/ip-utils/
Source Code Management

Source Code Management

https://github.com/robtimus/ip-utils

Download ip-utils

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.robtimus/ip-utils/ -->
<dependency>
    <groupId>com.github.robtimus</groupId>
    <artifactId>ip-utils</artifactId>
    <version>1.3</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.robtimus/ip-utils/
implementation 'com.github.robtimus:ip-utils:1.3'
// https://jarcasting.com/artifacts/com.github.robtimus/ip-utils/
implementation ("com.github.robtimus:ip-utils:1.3")
'com.github.robtimus:ip-utils:jar:1.3'
<dependency org="com.github.robtimus" name="ip-utils" rev="1.3">
  <artifact name="ip-utils" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.robtimus', module='ip-utils', version='1.3')
)
libraryDependencies += "com.github.robtimus" % "ip-utils" % "1.3"
[com.github.robtimus/ip-utils "1.3"]

Dependencies

compile (1)

Group / Artifact Type Version
com.github.robtimus : try-parse jar 1.1.1

test (3)

Group / Artifact Type Version
org.junit.jupiter : junit-jupiter jar 5.7.0
org.hamcrest : hamcrest jar 2.2
org.mockito : mockito-core jar 3.5.13

Project Modules

There are no modules declared in this project.

ip-utils

A set of utility classes for working with IP addresses. Its most important features:

A lightweight IP address implementation

An IP address implementation that has the following advantages over InetAddress:

  • It's very lightweight; for instance, it does not provide any functionality for hostname lookups or other functionality that requires network access.
  • Its factory methods support the more generic CharSequence instead of only String.
  • Its factory methods do not throw checked exceptions (like UnknownHostException).
  • It supports native parsing to Optional without having to catch any exceptions.
  • It supports native parsing to byte[].
  • It supports native parsing with ParsePosition.
  • It is Comparable.

To interact with existing code, it comes with bridge methods to convert to and from InetAddress. This allows you to replace most occurrences of InetAddress, Inet4Address and Inet6Address with IPAddress, IPv4Address and IPv6Address respectively.

Efficient IP range and subnet implementations

This library makes it possible to create an IP range from two IP addresses, or a subnet from a CIDR notation or an IP address and prefix length. This IP range or subnet is an immutable Collection of IP addresses with possibly thousands of elements, without the need to store all of these IP addresses.

Bean Validation support

The ip-validation library uses this library to provide validation constraints that work on both CharSequence and IPAddress. These not only allow you to validate that a value is a valid IP address, but also that the IP address is contained in a specific IP range or subnet.

JSON support

The ip-jackson-databind library provides support for serializing and deserializing IP addresses and ranges using Jackson.

Versions

Version
1.3
1.2
1.1
1.0