Class WebUtils

java.lang.Object
me.hsgamer.hscore.web.WebUtils

public final class WebUtils extends Object
Methods on web
  • Method Details

    • createConnection

      @NotNull public static @NotNull URLConnection createConnection(@NotNull @NotNull String address) throws IOException
      Create a new connection
      Parameters:
      address - the address / URL
      Returns:
      the connection
      Throws:
      IOException - If the URL is invalid or can't be connected
    • createConnection

      @NotNull public static @NotNull URLConnection createConnection(@NotNull @NotNull String address, Consumer<URLConnection> connectionConsumer) throws IOException
      Create a new connection
      Parameters:
      address - the address / URL
      connectionConsumer - the consumer to set the connection
      Returns:
      the connection
      Throws:
      IOException - If the URL is invalid or can't be connected
    • createHttpConnection

      @NotNull public static @NotNull HttpURLConnection createHttpConnection(@NotNull @NotNull String address) throws IOException
      Create a new HTTP connection
      Parameters:
      address - the address / URL
      Returns:
      the connection
      Throws:
      IOException - If the URL is invalid or can't be connected
    • createHttpConnection

      @NotNull public static @NotNull HttpURLConnection createHttpConnection(@NotNull @NotNull String address, Consumer<HttpURLConnection> connectionConsumer) throws IOException
      Create a new HTTP connection
      Parameters:
      address - the address / URL
      connectionConsumer - the consumer to set the connection
      Returns:
      the connection
      Throws:
      IOException - If the URL is invalid or can't be connected
    • createHttpsConnection

      @NotNull public static @NotNull HttpsURLConnection createHttpsConnection(@NotNull @NotNull String address) throws IOException
      Create a new HTTPS connection
      Parameters:
      address - the address / URL
      Returns:
      the connection
      Throws:
      IOException - If the URL is invalid or can't be connected
    • createHttpsConnection

      @NotNull public static @NotNull HttpsURLConnection createHttpsConnection(@NotNull @NotNull String address, Consumer<HttpsURLConnection> connectionConsumer) throws IOException
      Create a new HTTPS connection
      Parameters:
      address - the address / URL
      connectionConsumer - the consumer to set the connection
      Returns:
      the connection
      Throws:
      IOException - If the URL is invalid or can't be connected