aboutsummaryrefslogtreecommitdiff
path: root/common/src/at/gv/egovernment/moa/util/URLDecoder.java
diff options
context:
space:
mode:
author(no author) <(no author)@d688527b-c9ab-4aba-bd8d-4036d912da1d>2005-01-28 14:10:50 +0000
committer(no author) <(no author)@d688527b-c9ab-4aba-bd8d-4036d912da1d>2005-01-28 14:10:50 +0000
commit7916c117627db0411b35f202f88b2ab6e115361a (patch)
tree64d196008935d0c2913958edca0c4a8da62eec2f /common/src/at/gv/egovernment/moa/util/URLDecoder.java
parentd9183e34404ab3431c94002b963985a4346cf60a (diff)
downloadmoa-id-spss-tags/MOA-ID-1_20d09.tar.gz
moa-id-spss-tags/MOA-ID-1_20d09.tar.bz2
moa-id-spss-tags/MOA-ID-1_20d09.zip
This commit was manufactured by cvs2svn to create tagtags/MOA-ID-1_20d09
'MOA-ID-1_20d09'. git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/tags/MOA-ID-1_20d09@264 d688527b-c9ab-4aba-bd8d-4036d912da1d
Diffstat (limited to 'common/src/at/gv/egovernment/moa/util/URLDecoder.java')
-rw-r--r--common/src/at/gv/egovernment/moa/util/URLDecoder.java60
1 files changed, 0 insertions, 60 deletions
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 <code>application/x-www-form-urlencoded</code> 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;
- }
- }
-}