Class InetAddressMask

All Implemented Interfaces:
PointerInterface

public class InetAddressMask extends Object
#GInetAddressMask represents a range of IPv4 or IPv6 addresses
described by a base address and a length indicating how many bits
of the base address are relevant for matching purposes. These are
often given in string form. Eg, "10.0.0.0/8", or "fe80::/10".

https://docs.gtk.org/gio/class.InetAddressMask.html

  • Constructor Details

    • InetAddressMask

      public InetAddressMask(PointerContainer pointer)
    • InetAddressMask

      public InetAddressMask(@Nonnull InetAddress addr, int length)
      Creates a new #GInetAddressMask representing all addresses whose
      first @length bits match @addr.
      Parameters:
      addr - a #GInetAddress
      length - number of bits of @addr to use
  • Method Details

    • getClassHandler

      public static ClassHandler getClassHandler()
    • newFromStringInetAddressMask

      public static InetAddressMask newFromStringInetAddressMask(@Nonnull Str mask_string) throws AllocationError
      Parses @mask_string as an IP address and (optional) length, and
      creates a new #GInetAddressMask. The length, if present, is
      delimited by a "/". If it is not present, then the length is
      assumed to be the full length of the address.
      Parameters:
      mask_string - an IP address or address/length string
      Returns:
      a new #GInetAddressMask corresponding to @string, or %NULL on error.
      Throws:
      AllocationError
    • newFromStringInetAddressMask

      public static InetAddressMask newFromStringInetAddressMask(String mask_string) throws AllocationError
      Parses @mask_string as an IP address and (optional) length, and
      creates a new #GInetAddressMask. The length, if present, is
      delimited by a "/". If it is not present, then the length is
      assumed to be the full length of the address.
      Parameters:
      mask_string - an IP address or address/length string
      Returns:
      a new #GInetAddressMask corresponding to @string, or %NULL on error.
      Throws:
      AllocationError
    • equal

      public boolean equal(@Nonnull InetAddressMask mask2)
      Tests if @mask and @mask2 are the same mask.
      Parameters:
      mask2 - another #GInetAddressMask
      Returns:
      whether @mask and @mask2 are the same mask
    • getAddress

      public InetAddress getAddress()
      Gets @mask's base address
      Returns:
      @mask's base address
    • getFamily

      public int getFamily()
      Gets the #GSocketFamily of @mask's address
      Returns:
      the #GSocketFamily of @mask's address
    • getLength

      public int getLength()
      Gets @mask's length
      Returns:
      @mask's length
    • matches

      public boolean matches(@Nonnull InetAddress address)
      Tests if @address falls within the range described by @mask.
      Parameters:
      address - a #GInetAddress
      Returns:
      whether @address falls within the range described by @mask.
    • toStr

      public Str toStr()
      Converts @mask back to its corresponding string form.
      Returns:
      a string corresponding to @mask.
    • asInitable

      public Initable asInitable()
      Implements interface Initable. Call this to get access to interface functions.
      Returns:
      Initable
    • getTypeID

      public static long getTypeID()
    • getParentTypeID

      public static long getParentTypeID()
    • getTypeSize

      public static TypeSystem.TypeSize getTypeSize()
    • getParentTypeSize

      public static TypeSystem.TypeSize getParentTypeSize()
    • getInstanceSize

      public static int getInstanceSize()