Java URI Encode uriEncode(String decoded)

Here you can find the source of uriEncode(String decoded)

Description

uri Encode

License

Open Source License

Declaration

public static String uriEncode(String decoded) throws UnsupportedEncodingException 

Method Source Code

//package com.java2s;
/* --- BEGIN COPYRIGHT BLOCK ---
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation;
 * version 2.1 of the License.//  ww  w.  ja  v  a  2s. co m
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA  02110-1301  USA
 *
 * Copyright (C) 2007 Red Hat, Inc.
 * All rights reserved.
 * --- END COPYRIGHT BLOCK ---
 */

import java.io.UnsupportedEncodingException;

import java.net.URLEncoder;

public class Main {
    public static String uriEncode(String decoded) throws UnsupportedEncodingException {

        return URLEncoder.encode(decoded, "UTF-8");
    }
}

Related

  1. encodeURIComponentForJavaScript(String str)
  2. encodeURIParam(String s)
  3. encodeURIString(Writer out, String text, String encoding, int start)
  4. encodeUriWithPrefix(String uri)
  5. uriEncode(Object o)
  6. uriEncode(String input)
  7. uriEncodePath(String path)
  8. uriEncoding(String plainString)