0

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
Polymerase
  • 6,311
  • 11
  • 47
  • 65

1 Answers1

2

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.

Eduardo Pareja Tobes
  • 3,060
  • 1
  • 18
  • 19
  • Thanks for the introduction to [better-files](https://github.com/pathikrit/better-files). Hope that scala.reflect.io will make it official one day. BTW, in the link to [scala build.sbt](https://github.com/scala/scala/blob/v2.11.8/build.sbt#L344-L346). How do you highlight the lines like that? Is there any trick on GitHub to help you to generate the URL with highlight or is it something you should do manually? – Polymerase Nov 17 '16 at 14:46
  • 1
    no problem. For the highlighted lines thing, click on the start and end line numbers for the interval you want while holding the Shift key. – Eduardo Pareja Tobes Nov 17 '16 at 15:28