-
Notifications
You must be signed in to change notification settings - Fork 63
Code Examples
Sean C Foley edited this page Aug 25, 2024
·
157 revisions
These are the Java/JVM code examples. You can also compare to the Go code examples.
Creating, Parsing, Extracting Address/Subnet Info
- Parse IP Address or Subnet String
- Parse IP Address String with Prefix Length as Subnet or IP Address
- Check if String is an IP Address or Host Name
- Parse Socket Address
- Convert to/from byte[], int, BigInteger or InetAddress
- Get Prefix Length, Network Mask, Network Address, Version, Subnet Size and Segments from CIDR Address or Subnet
- Apply Masks and Prefix Lengths
- Check if Multicast
- Control Parsing of IP Addresses with Fewer Segments than Standard
Subnet or Range Containment, Matching, and Comparing
- Check if Subnet Contains Address or Subnet
- Get Position of Address in Subnet
- Get Distance between Two Addresses
- Check if Address or Subnet Falls within Address Range
- Select CIDR Prefix Block Subnets Containing an Address
- Select Addresses Contained by a CIDR Prefix Block Subnet
- Get Prefix Blocks Common to List of Addresses
- Longest Prefix Match
- Select Addresses and Subnets within Arbitrary Address Range
- Select Address Ranges Containing Arbitrary Address or Subnet
- Select CIDR Prefix Block Subnets Intersecting with Arbitrary Block
- Select Address Ranges Intersecting with Arbitrary Address Range
- Select Address Closest to Arbitrary Address
- Look up Associated IP Address Data by Containing Subnet or Matching Address
- Search Text of Database for Addresses in a CIDR Prefix Block Subnet
Subnetting and Other Subnet Operations
- Iterate through Subnet
- Iterate at Subnet Boundaries
- Sequential or Parallel Operations on Subnets using Streams
- From Start and End Address, Get Minimal List of CIDR Blocks Spanning the Range
- From Start and End Address, Get Single CIDR Block Covering Both
- Merge List of Addresses or Subnets into Minimal List of CIDR Blocks
- Break CIDR Prefix Block into Direct Component Blocks
- Iteratively Break CIDR Prefix Block into Component Blocks
- Derive New Subnet from Existing CIDR Subnet
- Remove Address or Subnet from Subnet
- Variable Length Subnetting
- Automatic Subnetting
- Allocate Multi-Nested Equal-Size Subnet Blocks
- From Start and End Address, Get Minimal List of Spanning Subnets with Single-Valued or Full-Range Segments
Converting to/from Other Formats
- Produce a Variety of Strings of an Address for Text Search
- Convert to/from Binary String from/to IP Address
- Convert to/from IPv6 Address from/to MAC Address
- Convert to/from IPv6 Address from/to Ascii Base 85 Encoding
- Convert Subnet Members to Integers using Filter, Map and Collect Stream Operations
- Convert to/from IPv4 Address from/to IPv6 Address
- Extend Address Classes for Customized Conversion to/from IPv4 Address from/to IPv6 Address
- Write/Read Addresses to/from Direct Byte Buffer in Native Byte Order
- Range over Trie Iterators of Subnet Mappings to Produce Nested Subnet Yaml