diff options
Diffstat (limited to 'EssentialsUpdate/src/com/earth2me/essentials/update/PastieUpload.java')
-rw-r--r-- | EssentialsUpdate/src/com/earth2me/essentials/update/PastieUpload.java | 40 |
1 files changed, 0 insertions, 40 deletions
diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/PastieUpload.java b/EssentialsUpdate/src/com/earth2me/essentials/update/PastieUpload.java deleted file mode 100644 index 6cad44e4d..000000000 --- a/EssentialsUpdate/src/com/earth2me/essentials/update/PastieUpload.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.earth2me.essentials.update; - -import java.io.IOException; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.HashMap; -import java.util.Map; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - - -public class PastieUpload -{ - private final transient PostToUrl connection; - - public PastieUpload() throws MalformedURLException - { - connection = new PostToUrl(new URL("http://pastie.org/pastes")); - } - - public String send(final String data) throws IOException - { - final Map<String, Object> map = new HashMap<String, Object>(); - map.put("paste[parser_id]", "19"); - map.put("paste[authorization]", "burger"); - map.put("paste[body]", data); - map.put("paste[restricted]", "1"); - final String html = connection.send(map); - final Matcher matcher = Pattern.compile("(?s).*\\?key=([a-z0-9]+).*").matcher(html); - if (matcher.matches()) - { - final String key = matcher.group(1); - return "http://pastie.org/private/" + key; - } - else - { - throw new IOException("Failed to upload to pastie.org"); - } - } -}
\ No newline at end of file |