Java URL Decode decode(String value)

Here you can find the source of decode(String value)

Description

Hides the irritating declared exception.

License

Apache License

Exception

Parameter Description
RuntimeException if there is an UnsupportedEncodingException

Return

null if there is an IllegalArgumentException

Declaration

public static String decode(String value) 

Method Source Code

//package com.java2s;
// Licensed under the Apache License, Version 2.0 (the "License");

import java.io.UnsupportedEncodingException;

import java.net.URLDecoder;

public class Main {
    /**/*from  w  w w  .ja  va2s  . c  o  m*/
     * Hides the irritating declared exception.
     * @return null if there is an IllegalArgumentException
     * @throws RuntimeException if there is an UnsupportedEncodingException
     */
    public static String decode(String value) {
        try {
            return URLDecoder.decode(value, "utf-8");
        } catch (UnsupportedEncodingException ex) {
            throw new RuntimeException(ex);
        } catch (IllegalArgumentException ex) {
            return null;
        }
    }
}

Related

  1. decode(String source, String encoding)
  2. decode(String source, String encoding)
  3. decode(String str)
  4. decode(String str)
  5. decode(String value)
  6. decode(String value)
  7. decode(String value)
  8. decode(String value, String charset)
  9. decode(String value, String charset)