Class NetworkParser

java.lang.Object
one.tranic.t.base.parse.network.NetworkParser

public class NetworkParser extends Object
  • Constructor Details

    • NetworkParser

      public NetworkParser()
  • Method Details

    • isPrivateIp

      public static boolean isPrivateIp(InetAddress address)
      Checks if an InetAddress is a private IP address.
      Parameters:
      address - the InetAddress to check
      Returns:
      true if the address is a private IP, false otherwise
    • isPrivateIp

      public static boolean isPrivateIp(String address) throws UnknownHostException
      Checks if a given IP address in String format is a private IP address.
      Parameters:
      address - the IP address as a String to check
      Returns:
      true if the address is a private IP, false otherwise
      Throws:
      UnknownHostException - if the string cannot be parsed as an IP address
    • isNatRange

      public static boolean isNatRange(InetAddress address)
      Helper method to detect extended NAT internal ranges.
      Parameters:
      address - the InetAddress to check
      Returns:
      true if part of NAT internal ranges, false otherwise
    • resource

      public static InputStream resource(@NotNull @NotNull String filename)
      Retrieves an InputStream for a specified resource file by its filename.
      Parameters:
      filename - the name of the resource file to be loaded
      Returns:
      an InputStream for the resource file, or null if the resource cannot be found or accessed