Here you can find the source of convertToURI(String uriOrPath)
Parameter | Description |
---|---|
uriOrPath | uri or path to convert |
public static URI convertToURI(String uriOrPath)
//package com.java2s; import java.io.File; import java.net.URI; public class Main { /**//from w w w .j av a 2 s . c om * Converts a string representing a file or uri to a uri object. * * @param uriOrPath * uri or path to convert * @return uri */ public static URI convertToURI(String uriOrPath) { if (uriOrPath.contains("://")) { return URI.create(uriOrPath); } else { return new File(uriOrPath).toURI(); } } }