import ch.lambdaj.function.convert.Converter;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
public class ConvertUrlToUri implements Converter<URL, URI>
{
public static ConvertUrlToUri convertUrlToUri()
{
return new ConvertUrlToUri();
}
@Override
public URI convert(final URL from)
{
try
{
return from.toURI();
}
catch (final URISyntaxException e)
{
throw new RuntimeException("unable to convert " + from + " to URI", e);
}
}
} |
import ch.lambdaj.function.convert.Converter;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
public class ConvertUrlToUri implements Converter<URL, URI>
{
public static ConvertUrlToUri convertUrlToUri()
{
return new ConvertUrlToUri();
}
@Override
public URI convert(final URL from)
{
try
{
return from.toURI();
}
catch (final URISyntaxException e)
{
throw new RuntimeException("unable to convert " + from + " to URI", e);
}
}
}