biz.gabrys.maven.plugins.css.splitter.net.UrlEscaper Maven / Gradle / Ivy
/*
* CSS Splitter Maven Plugin
* http://css-splitter-maven-plugin.projects.gabrys.biz/
*
* Copyright (c) 2015 Adam Gabryś
*
* This file is licensed under the BSD 3-Clause (the "License").
* You may not use this file except in compliance with the License.
* You may obtain:
* - a copy of the License at project page
* - a template of the License at https://opensource.org/licenses/BSD-3-Clause
*/
package biz.gabrys.maven.plugins.css.splitter.net;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
public final class UrlEscaper {
private UrlEscaper() {
// blocks the possibility of create a new instance
}
public static String escape(final String value) {
try {
return URLEncoder.encode(value, "UTF-8").replaceAll("\\+", "%20");
} catch (final UnsupportedEncodingException e) {
throw new IllegalStateException(e);
}
}
}