Class NetworkService

java.lang.Object
de.bytestore.hostinger.internal.service.NetworkService

@Service @Component public class NetworkService extends Object
  • Constructor Details

    • NetworkService

      public NetworkService()
  • Method Details

    • parsePorts

      public List<Integer> parsePorts(String formatIO)
      Parses the formatIO string and generates a list of ports based on the given port inputs.
      Parameters:
      formatIO - A string representing the port inputs. The string may contain single port numbers or port ranges specified in the format "start-end", separated by commas.
      Returns:
      A list of integers representing the generated ports.
    • generatePorts

      public List<Integer> generatePorts(String[] portInputs)
      Generates a list of ports based on the given port inputs.
      Parameters:
      portInputs - An array of strings representing the port inputs. The array may contain single port numbers or port ranges specified in the format "start-end".
      Returns:
      A list of integers representing the generated ports.
    • generateMAC

      public String generateMAC()
      Generates a random MAC address.
      Returns:
      The randomly generated MAC address.
    • downloadFile

      public void downloadFile(String urlIO, String destinationIO, DownloadCallback callbackIO)
      Downloads a file from the given URL to the specified destination.
      Parameters:
      urlIO - The URL of the file to download.
      destinationIO - The destination path to save the downloaded file.
      callbackIO -
      Throws:
      IOException - If an I/O error occurs during the download process.
    • isIPv4

      public boolean isIPv4(String remoteAddr)
      Checks if the given remote address is an IPv4 address.
      Parameters:
      remoteAddr - The remote address to check.
      Returns:
      true if the remote address is an IPv4 address, false otherwise.
    • downloadImage

      public io.jmix.core.FileRef downloadImage(URL urlIO, io.jmix.core.FileStorage fileStorage)
      Downloads an image from the given URL and saves it using the provided file storage.
      Parameters:
      urlIO - The URL of the image.
      fileStorage - The file storage used to save the image.
      Returns:
      A FileRef object representing the saved image file.
      Throws:
      RuntimeException - If an IOException occurs during the download process.