I see the scala.reflect.io.File class, is this supposed to help with file operations? Am I supposed to prefer to use this rather than java.io.File? What is the purpose of th
java.io.File
is what you should use in general.
scala.reflect.io.File
can be used for file operations. Code using it idiomatic for scala than using Java's File class. This is because it uses other scala classes such as scala.io.Codec
and scala.Option
and utilizes scala features such as implicit parameter. However, it is not (and may never be) considered ready for general use.
According to the source for scala.reflect.io.File (github):
/**
* ''Note: This library is considered experimental \
and should not be used unless you know what you are doing.''
*/
If you know what you are doing or are just wanting to experiment (and do not care if things don't work or break in the future) then you may decide to use scala.reflect.io.File. If you do decide to use it, the source code looks well documented with ScalaDoc comments.