You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm going to use the Akka Streams sample in our Helsinki Scala Club meetup. Unfortunately, one of the samples reads a resource using a build-time relative path. This only works in development, of course, and not in production. In fact, the current way is not using the file as a resource, at all. All of this might be misleading to Scala learners.
Unfortunately, I don't know how to fix this for real. Using a Stream instead of File changes the later iteration code.
Here is a code that is somewhere in between. Creates a File out of a resource. This is done pretty often, but is not ideal, or recommended. Better than the current way, though.
// Note: Resources should be read using '.getResourceAsStream'. While the code shows Akka Streams, it should not
// teach bad (nonfunctional, in production) manners. AKa240116
//
//val log: InputStream = getClass.getResourceAsStream("/logfile.txt")
// read lines from a log file
val logFile: File = new File(getClass.getResource("/logfile.txt").toURI)
The text was updated successfully, but these errors were encountered:
I'm going to use the Akka Streams sample in our Helsinki Scala Club meetup. Unfortunately, one of the samples reads a resource using a build-time relative path. This only works in development, of course, and not in production. In fact, the current way is not using the file as a resource, at all. All of this might be misleading to Scala learners.
Unfortunately, I don't know how to fix this for real. Using a Stream instead of File changes the later iteration code.
Here is a code that is somewhere in between. Creates a File out of a resource. This is done pretty often, but is not ideal, or recommended. Better than the current way, though.
The text was updated successfully, but these errors were encountered: