since a Path
class does not have public constructor ,so path object are created using get
factory method in Paths
object.
e.g
Path p2 = Paths.get("/home/admin","Migrations","/blog/tables/6-rating.xml");
//or
Path p2 = Paths.get(new URI("file://home/debianaut/Migrations/blog.sakhunzai/tables/6-rating.xml"));
how we can do this in clojure way ?
user> (java.nio.file.Paths/get "/home/justin" (into-array [".lein" "profiles.clj"]))
#<UnixPath /home/justin/.lein/profiles.clj>
varargs java methods need an array containing all remaining args as their final argument.
The first string outside the array is needed in order for the method dispatch to match the right method.
For completeness, here is an example using a URI (much more straightforward):
user> (java.nio.file.Paths/get (java.net.URI. "file:///home/justin"))
#<UnixPath /home/justin>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With