Polymerase Polymerase - 23 days ago 6
Scala Question

Scaladoc API of scala.reflect.io?

Is there any public Scaladoc API of scala.reflect.io? It seems there are useful IO utilities in there. Would it be more beneficial to use these instead of Java IO?

Saw in Scala 2.11.8 Source
there is an object scala.reflect.io.Directory which allows to do operation on dirs:

scala> val cd = scala.reflect.io.Directory(".")
cd: scala.reflect.io.Directory = .

scala> cd.toCanonical
res0: scala.reflect.io.Path = /home/myusername/myProject1

scala> cd. <TAB>
/ dirs isDirectory parent toCanonical
addExtension endsWith isEmpty parents toDirectory
canRead equals isFile path toFile
canWrite exists isFresher relativize toString
changeExtension extension isSame resolve toURI
createDirectory files jfile segments toURL
createFile hasExtension lastModified separator truncate
deepFiles hashCode length separatorStr walk
deepList ifDirectory list stripExtension walkFilter
delete ifFile name toAbsolute
deleteRecursively isAbsolute normalize toAbsoluteWithRoot

Answer

scala.reflect.io is explicitly excluded from scaladoc generation, as you can see in the build definition here. Given the note at the beginning of every file there: ''Note: This library is considered experimental and should not be used unless you know what you are doing.'' I wouldn't consider it an option, at the very least unless you know what you're doing.

The closest thing to an standard Scala file I/O library is I think better-files, which is a wrapper around Java NIO File stuff.