diff --git a/src/com/massivecraft/mcore/util/WebUtil.java b/src/com/massivecraft/mcore/util/WebUtil.java new file mode 100644 index 00000000..610b280e --- /dev/null +++ b/src/com/massivecraft/mcore/util/WebUtil.java @@ -0,0 +1,47 @@ +package com.massivecraft.mcore.util; + +import java.io.IOException; +import java.io.InputStream; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; + +public class WebUtil +{ + private static final ExecutorService executor = Executors.newSingleThreadExecutor(); + + public static void asyncGetTouch(String url) + { + try + { + asyncGetTouch(new URL(url)); + } + catch (MalformedURLException e) + { + e.printStackTrace(); + } + } + + public static void asyncGetTouch(final URL url) + { + executor.execute(new Runnable() + { + @Override + public void run() + { + try + { + InputStream inputStream = null; + + inputStream = url.openStream(); + inputStream.close(); + } + catch (IOException e) + { + e.printStackTrace(); + } + } + }); + } +}