score:0

to have a properly formatted uniform resource identifier uri for identification of a particular resource, use java.net.uri with scheme, host, and relative path.

import java.net.uri

val scheme = "viewfs"
val host = "x"
val path = paths.get("/", "b", "c").tostring //path starts with "/" to handle exception - java.net.urisyntaxexception: relative path in absolute uri

val uri = new uri(scheme, host, path, null)
println(uri.tostring) 

//output - viewfs://x/b/c

Related Query

More Query from same tag