File tree Expand file tree Collapse file tree 3 files changed +8
-8
lines changed
main/scala/progscala3/concurrency/process
script/scala/progscala3/basicoop Expand file tree Collapse file tree 3 files changed +8
-8
lines changed Original file line number Diff line number Diff line change 22package progscala3 .concurrency .process
33
44import scala .sys .process .*
5- import java .net .URL
5+ import java .net .URI
66import java .io .File
77
88object DoProcess :
99
1010 // Build a process to open a URL, redirect the output to
1111 // "grep $filter", and append the output to file (not overwrite it).
1212 def findURL (url : String , filter : String ) =
13- URL (url) #> s " grep $filter" #>> File (s " $filter.txt " )
13+ URI (url).toURL( ) #> s " grep $filter" #>> File (s " $filter.txt " )
1414
1515 // Run ls -l on the file. If it exists, then count the lines.
1616 def countLines (fileName : String ) =
Original file line number Diff line number Diff line change 11// tag::traits[]
22// src/script/scala/progscala3/basicoop/Exports.scala
33
4- import java .net .URL
4+ import java .net .{ URI , URL }
55
66case class UserName (value : String ): // <1>
77 assert(value.length > 0 )
@@ -25,7 +25,7 @@ class DirectoryAuthenticate(location: URL) extends Authenticate:
2525// tag::service1[]
2626object ServiceWithoutExports :
2727 private val dirAuthenticate =
28- DirectoryAuthenticate (URL (" https://directory.wtf" ))
28+ DirectoryAuthenticate (URI (" https://directory.wtf" ).toURL( ))
2929
3030 def authenticate (username : UserName , password : Password ): Boolean =
3131 dirAuthenticate(username, password)
@@ -35,7 +35,7 @@ object ServiceWithoutExports:
3535// tag::service2[]
3636object Service :
3737 private val dirAuthenticate =
38- DirectoryAuthenticate (URL (" https://directory.wtf" ))
38+ DirectoryAuthenticate (URI (" https://directory.wtf" ).toURL( ))
3939
4040 export dirAuthenticate .{isAuthenticated , apply as authenticate }
4141// end::service2[]
Original file line number Diff line number Diff line change 33// This version of Exports.scala doesn't appear in the book, but it
44// includes more examples of exporting parts of internal dependencies.
55
6- import java .net .URL
6+ import java .net .{ URI , URL }
77
88case class UserName (value : String ):
99 assert(value.length > 0 )
@@ -41,7 +41,7 @@ class AsyncTokenizer extends AsyncWorker[String, Seq[String]]:
4141
4242object ServiceWithoutExports :
4343 private val dirAuthenticate =
44- DirectoryAuthenticate (URL (" https://directory.wtf" ))
44+ DirectoryAuthenticate (URI (" https://directory.wtf" ).toURL( ))
4545 private val manager = ResourceManager (sys.env)
4646 private val tokenizer = AsyncTokenizer ()
4747
@@ -55,7 +55,7 @@ object ServiceWithoutExports:
5555// tag::service2[]
5656object Service :
5757 private val dirAuthenticate =
58- DirectoryAuthenticate (URL (" https://directory.wtf" ))
58+ DirectoryAuthenticate (URI (" https://directory.wtf" ).toURL( ))
5959 private val manager = ResourceManager (sys.env)
6060 private val tokenizer = AsyncTokenizer ()
6161
You can’t perform that action at this time.
0 commit comments