2016-01-15 09:18:19 -05:00
|
|
|
package eu.kanade.tachiyomi.util;
|
2015-11-30 07:07:57 -05:00
|
|
|
|
|
|
|
import java.net.URI;
|
|
|
|
import java.net.URISyntaxException;
|
|
|
|
|
2016-04-28 12:45:39 -04:00
|
|
|
public final class UrlUtil {
|
2015-11-30 07:07:57 -05:00
|
|
|
|
2016-04-28 12:45:39 -04:00
|
|
|
private UrlUtil() throws InstantiationException {
|
|
|
|
throw new InstantiationException("This class is not for instantiation");
|
|
|
|
}
|
|
|
|
|
2015-11-30 07:07:57 -05:00
|
|
|
public static String getPath(String s) {
|
|
|
|
try {
|
|
|
|
URI uri = new URI(s);
|
|
|
|
String out = uri.getPath();
|
|
|
|
if (uri.getQuery() != null)
|
|
|
|
out += "?" + uri.getQuery();
|
|
|
|
if (uri.getFragment() != null)
|
|
|
|
out += "#" + uri.getFragment();
|
|
|
|
return out;
|
|
|
|
} catch (URISyntaxException e) {
|
|
|
|
return s;
|
|
|
|
}
|
|
|
|
}
|
2016-01-23 07:58:53 -05:00
|
|
|
|
2015-11-30 07:07:57 -05:00
|
|
|
}
|