public class DownloadUtils
extends java.lang.Object
| Constructor and Description |
|---|
DownloadUtils() |
| Modifier and Type | Method and Description |
|---|---|
static byte[] |
download(java.lang.String url)
Download a file from a direkt link
|
static void |
downloadPlugin(java.lang.String url,
java.io.File file)
Download a plugin from a direct link
|
static boolean |
downloadSpigotMcPlugin(int pluginId,
java.io.File file)
Download a plugin from the spiget api
|
static java.lang.String |
getNewestVersion()
Get the newest plugin manager version from github
|
static com.google.gson.JsonObject |
getSpigotMcPluginInfo(int pluginId)
Get the information about a plugin on spigotmc
Please check spiget documentation for more information |
static java.net.HttpURLConnection |
openConnection(java.lang.String url)
Open a connection to an url
|
static byte[] |
readBytes(java.net.HttpURLConnection connection)
Read the bytes from a connection and return them
|
static java.lang.String |
readString(java.net.HttpURLConnection connection)
Read a string from a connection and return it
|
static void |
readWriteBytes(java.net.HttpURLConnection connection,
java.io.OutputStream os)
Read the bytes from a connection and write them to an output stream
|
public static java.net.HttpURLConnection openConnection(java.lang.String url)
throws java.io.IOException
url - The url to openjava.io.IOException - when the connection could not be openedpublic static void readWriteBytes(java.net.HttpURLConnection connection,
java.io.OutputStream os)
throws java.io.IOException
connection - The connection to read fromos - The output stream to write tojava.io.IOException - when the connection could not be read or the output stream could not be written topublic static byte[] readBytes(java.net.HttpURLConnection connection)
throws java.io.IOException
connection - The connection to read fromjava.io.IOException - when the connection could not be readpublic static java.lang.String readString(java.net.HttpURLConnection connection)
throws java.io.IOException
connection - The connection to read fromjava.io.IOException - when the connection could not be readpublic static com.google.gson.JsonObject getSpigotMcPluginInfo(int pluginId)
throws java.io.IOException
pluginId - The id of the pluginjava.io.IOException - when the plugin was not foundpublic static boolean downloadSpigotMcPlugin(int pluginId,
java.io.File file)
throws java.io.IOException
pluginId - The plugin idfile - where to save the pluginjava.io.IOException - when the plugin could not be savedpublic static void downloadPlugin(java.lang.String url,
java.io.File file)
throws java.io.IOException
url - The URL of the pluginfile - where to save the pluginjava.io.IOException - when the url is invalid/the plugin could not be foundpublic static byte[] download(java.lang.String url)
throws java.io.IOException
url - THe URL of the filejava.io.IOException - When the URL is invalidpublic static java.lang.String getNewestVersion()
throws java.io.IOException
java.io.IOException - When the github url could not be accessed