aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/cc/polyfrost/oneconfig/utils
diff options
context:
space:
mode:
authornextdaydelivery <79922345+nxtdaydelivery@users.noreply.github.com>2022-05-25 18:45:34 +0100
committernextdaydelivery <79922345+nxtdaydelivery@users.noreply.github.com>2022-05-25 18:45:34 +0100
commita183b82c9ee063a6377554ea8c797953b1ded994 (patch)
treecf0ebdccf1771adf99fe08714301cc19212a13c5 /src/main/java/cc/polyfrost/oneconfig/utils
parenta651c8b71d2b30b0da3182de48a213ca94acae54 (diff)
downloadOneConfig-a183b82c9ee063a6377554ea8c797953b1ded994.tar.gz
OneConfig-a183b82c9ee063a6377554ea8c797953b1ded994.tar.bz2
OneConfig-a183b82c9ee063a6377554ea8c797953b1ded994.zip
OC-38 almost finish basic button rewrite
Diffstat (limited to 'src/main/java/cc/polyfrost/oneconfig/utils')
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/utils/IOUtils.java21
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/utils/InternetUtils.java22
2 files changed, 22 insertions, 21 deletions
diff --git a/src/main/java/cc/polyfrost/oneconfig/utils/IOUtils.java b/src/main/java/cc/polyfrost/oneconfig/utils/IOUtils.java
index 73a8a13..7263a19 100644
--- a/src/main/java/cc/polyfrost/oneconfig/utils/IOUtils.java
+++ b/src/main/java/cc/polyfrost/oneconfig/utils/IOUtils.java
@@ -1,11 +1,9 @@
package cc.polyfrost.oneconfig.utils;
-import java.awt.*;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
-import java.net.URI;
import java.net.URL;
import java.nio.Buffer;
import java.nio.ByteBuffer;
@@ -54,23 +52,4 @@ public final class IOUtils {
}
}
- public static void browseLink(String uri) {
- try {
- browseLink(new URI(uri));
- } catch (Exception e) {
- e.printStackTrace();
- System.err.println("Invalid URI: " + uri);
- }
- }
- public static void browseLink(URI uri) {
- if(Desktop.isDesktopSupported() && Desktop.getDesktop().isSupported(Desktop.Action.BROWSE)) {
- try {
- Desktop.getDesktop().browse(uri);
- } catch (IOException e) {
- e.printStackTrace();
- System.err.println("Failed to open URL in browser: " + uri);
- }
- }
- }
-
} \ No newline at end of file
diff --git a/src/main/java/cc/polyfrost/oneconfig/utils/InternetUtils.java b/src/main/java/cc/polyfrost/oneconfig/utils/InternetUtils.java
index db83825..6d6d7ed 100644
--- a/src/main/java/cc/polyfrost/oneconfig/utils/InternetUtils.java
+++ b/src/main/java/cc/polyfrost/oneconfig/utils/InternetUtils.java
@@ -3,8 +3,10 @@ package cc.polyfrost.oneconfig.utils;
import com.google.gson.JsonElement;
import org.apache.commons.io.IOUtils;
+import java.awt.*;
import java.io.*;
import java.net.HttpURLConnection;
+import java.net.URI;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.security.MessageDigest;
@@ -83,4 +85,24 @@ public class InternetUtils {
}
return stringBuffer.toString();
}
+
+ public static void browseLink(String uri) {
+ try {
+ browseLink(new URI(uri));
+ } catch (Exception e) {
+ e.printStackTrace();
+ System.err.println("Invalid URI: " + uri);
+ }
+ }
+
+ public static void browseLink(URI uri) {
+ if(Desktop.isDesktopSupported() && Desktop.getDesktop().isSupported(Desktop.Action.BROWSE)) {
+ try {
+ Desktop.getDesktop().browse(uri);
+ } catch (IOException e) {
+ e.printStackTrace();
+ System.err.println("Failed to open URL in browser: " + uri);
+ }
+ }
+ }
}