Class TempConnectionManager

java.lang.Object
org.kobe.xbot.Utilities.TempConnectionManager

public class TempConnectionManager extends Object
TempConnectionManager - A utility class for managing temporary connection information.

This class handles the reading and writing of a temporary file that stores an IP address used for a network connection. The file is located in the system's temporary directory.

Author: Kobe Lei Version: 1.0 Package: org.kobe.xbot.Utilities

This is part of the XTABLES project, providing utility functions for managing temporary network connection data across application restarts.

  • Constructor Details

    • TempConnectionManager

      public TempConnectionManager()
  • Method Details

    • get

      public static String get()
      Retrieves the stored IP address from the temporary connection file.

      If the temporary file exists and contains data, the IP address is read and returned. Otherwise, null is returned.

      Returns:
      the stored IP address, or null if the file does not exist or cannot be read.
    • invalidate

      public static void invalidate()
      Invalidates the temporary connection file.

      This method deletes the temporary file that stores the IP address, ensuring that the connection information is no longer available. If the file does not exist, the method does nothing.

    • set

      public static void set(String ipAddress)
      Sets the provided IP address in the temporary connection file.

      If the temporary file does not exist, it is created. The IP address is then written to the file, ensuring that the connection information persists across application restarts.

      Parameters:
      ipAddress - the IP address to store in the temporary file.