Class NetworkService
java.lang.Object
de.bytestore.hostinger.internal.service.NetworkService
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddownloadFile(String urlIO, String destinationIO, DownloadCallback callbackIO) Downloads a file from the given URL to the specified destination.io.jmix.core.FileRefdownloadImage(URL urlIO, io.jmix.core.FileStorage fileStorage) Downloads an image from the given URL and saves it using the provided file storage.Generates a random MAC address.generatePorts(String[] portInputs) Generates a list of ports based on the given port inputs.booleanChecks if the given remote address is an IPv4 address.parsePorts(String formatIO) Parses the formatIO string and generates a list of ports based on the given port inputs.
-
Constructor Details
-
NetworkService
public NetworkService()
-
-
Method Details
-
parsePorts
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
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
Generates a random MAC address.- Returns:
- The randomly generated MAC address.
-
downloadFile
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
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
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.
-