From a5694b6491307efb55893ac7ea61920b48d8c9cc Mon Sep 17 00:00:00 2001 From: "(no author)" <(no author)@d688527b-c9ab-4aba-bd8d-4036d912da1d> Date: Mon, 28 Jun 2004 20:46:16 +0000 Subject: This commit was manufactured by cvs2svn to create tag 'Root_proxy_parameter_ordering_projekt'. git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/tags/Root_proxy_parameter_ordering_projekt@146 d688527b-c9ab-4aba-bd8d-4036d912da1d --- .../src/at/gv/egovernment/moa/util/URLDecoder.java | 60 ---------------------- 1 file changed, 60 deletions(-) delete mode 100644 common/src/at/gv/egovernment/moa/util/URLDecoder.java (limited to 'common/src/at/gv/egovernment/moa/util/URLDecoder.java') diff --git a/common/src/at/gv/egovernment/moa/util/URLDecoder.java b/common/src/at/gv/egovernment/moa/util/URLDecoder.java deleted file mode 100644 index a20820f7e..000000000 --- a/common/src/at/gv/egovernment/moa/util/URLDecoder.java +++ /dev/null @@ -1,60 +0,0 @@ -package at.gv.egovernment.moa.util; - -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.StringReader; -import java.io.UnsupportedEncodingException; - -/** - * Decodes an URL encoded String using a specified character encoding. - * Provides a function missing in JDK 1.3. - * @author Paul Ivancsics - * @version $Id$ - */ -public class URLDecoder { - - /** - * Decodes an application/x-www-form-urlencoded string using a specific encoding scheme. - * @param s the string to decode - * @param encoding name of character encoding - * @return the newly decoded string - * @throws UnsupportedEncodingException if the encoding is not supported - */ - public static String decode(String s, String encoding) throws UnsupportedEncodingException { - StringReader in = new StringReader(s); - ByteArrayOutputStream bout = new ByteArrayOutputStream(); - for (int b = read(in); b >= 0; b = read(in)) - bout.write(b); - return bout.toString(encoding); - } - /** - * Decodes the next byte from the string reader. - * @param in string reader - * @return the next byte decoded; - * -1 upon end of string, on erroneous data, and on any exception caught - * @todo syntax check on string - */ - private static int read(StringReader in) { - try { - int b = in.read(); - if (b == '+') - return ' '; - if (b == '%') { - char[] hex = new char[2]; - if (in.read(hex, 0, 2) >= 0) { - String hexString = new String(hex); - return Integer.valueOf(hexString, 16).intValue(); - } - else - return -1; - } - return b; - } - catch (IOException ex) { - return -1; - } - catch (NumberFormatException ex) { - return -1; - } - } -} -- cgit v1.2.3