Interface Inet

All Known Implementing Classes:
Inet.V4, Inet.V6

public sealed interface Inet permits Inet.V4, Inet.V6
PostgreSQL inet type. IPv4 or IPv6 host address with optional subnet mask.

Holds an IPv4 or IPv6 host address, and optionally its subnet, all in one field. The subnet is represented by the number of network address bits present in the host address (the "netmask"). If the netmask is 32 and the address is IPv4 (or 128 for IPv6), the value represents just a single host.

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static final record 
    IPv4 host address with optional subnet mask.
    static final record 
    IPv6 host address with optional subnet mask.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Appends the PostgreSQL text representation of this address to sb.
    void
    Encodes this address in PostgreSQL binary wire format into out.
    Returns the address part of this Inet as a InetAddress.
  • Method Details

    • appendInTextTo

      void appendInTextTo(StringBuilder sb)
      Appends the PostgreSQL text representation of this address to sb.
    • encodeInBinary

      void encodeInBinary(ByteArrayOutputStream out)
      Encodes this address in PostgreSQL binary wire format into out.
    • toInetAddress

      InetAddress toInetAddress()
      Returns the address part of this Inet as a InetAddress. The netmask is not represented in the returned object.