Record Class Cidr.V6

java.lang.Object
java.lang.Record
io.codemine.java.postgresql.codecs.Cidr.V6
Record Components:
w1 - First 32 bits of the IPv6 network address in big-endian order (host bits must be zero).
w2 - Second 32 bits of the IPv6 network address in big-endian order.
w3 - Third 32 bits of the IPv6 network address in big-endian order.
w4 - Fourth 32 bits of the IPv6 network address in big-endian order.
netmask - Network mask length in the range 0–128.
All Implemented Interfaces:
Cidr
Enclosing interface:
Cidr

public static record Cidr.V6(int w1, int w2, int w3, int w4, byte netmask) extends Record implements Cidr
IPv6 CIDR block.
  • Nested Class Summary

    Nested classes/interfaces inherited from interface io.codemine.java.postgresql.codecs.Cidr

    Cidr.V4, Cidr.V6
  • Constructor Summary

    Constructors
    Constructor
    Description
    V6(int w1, int w2, int w3, int w4, byte netmask)
    Canonical constructor that enforces the documented invariants.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Appends the PostgreSQL text representation of this CIDR block to sb.
    void
    Encodes this CIDR block in PostgreSQL binary wire format into out.
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    byte
    Returns the value of the netmask record component.
    Returns a string representation of this record class.
    int
    w1()
    Returns the value of the w1 record component.
    int
    w2()
    Returns the value of the w2 record component.
    int
    w3()
    Returns the value of the w3 record component.
    int
    w4()
    Returns the value of the w4 record component.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • V6

      public V6(int w1, int w2, int w3, int w4, byte netmask)
      Canonical constructor that enforces the documented invariants.
      • netmask must be in the range 0–128 (inclusive)
      • all host bits of the address beyond the netmask must be zero
      Throws:
      IllegalArgumentException - if the arguments do not satisfy the invariants
  • Method Details

    • appendInTextTo

      public void appendInTextTo(StringBuilder sb)
      Description copied from interface: Cidr
      Appends the PostgreSQL text representation of this CIDR block to sb.
      Specified by:
      appendInTextTo in interface Cidr
    • encodeInBinary

      public void encodeInBinary(ByteArrayOutputStream out)
      Description copied from interface: Cidr
      Encodes this CIDR block in PostgreSQL binary wire format into out.
      Specified by:
      encodeInBinary in interface Cidr
    • toString

      public String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • w1

      public int w1()
      Returns the value of the w1 record component.
      Returns:
      the value of the w1 record component
    • w2

      public int w2()
      Returns the value of the w2 record component.
      Returns:
      the value of the w2 record component
    • w3

      public int w3()
      Returns the value of the w3 record component.
      Returns:
      the value of the w3 record component
    • w4

      public int w4()
      Returns the value of the w4 record component.
      Returns:
      the value of the w4 record component
    • netmask

      public byte netmask()
      Returns the value of the netmask record component.
      Returns:
      the value of the netmask record component