Here you can find the source of encodeUri(final String uri)
Parameter | Description |
---|---|
uri | Path (or any string) to convert. |
public static String encodeUri(final String uri)
//package com.java2s; /*/*w ww . j a va 2s . c o m*/ * ==================================================================== * Copyright (c) 2005-2012 sventon project. All rights reserved. * * This software is licensed as described in the file LICENSE, which * you should have received as part of this distribution. The terms * are also available at http://www.sventon.org. * If newer versions of this license are posted there, you may use a * newer version instead, at your option. * ==================================================================== */ import java.net.URI; import java.net.URISyntaxException; public class Main { /** * URI encodes a path to comply with Subversion specification (according to rfc2396). * * @param uri Path (or any string) to convert. * @return String URL encoded using UTF-8. */ public static String encodeUri(final String uri) { try { return new URI(null, null, uri, null).toASCIIString(); } catch (URISyntaxException e) { throw new IllegalArgumentException(e); } } }