File tree 3 files changed +8
-8
lines changed
main/scala/progscala3/concurrency/process
script/scala/progscala3/basicoop
3 files changed +8
-8
lines changed Original file line number Diff line number Diff line change 2
2
package progscala3 .concurrency .process
3
3
4
4
import scala .sys .process .*
5
- import java .net .URL
5
+ import java .net .URI
6
6
import java .io .File
7
7
8
8
object DoProcess :
9
9
10
10
// Build a process to open a URL, redirect the output to
11
11
// "grep $filter", and append the output to file (not overwrite it).
12
12
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 " )
14
14
15
15
// Run ls -l on the file. If it exists, then count the lines.
16
16
def countLines (fileName : String ) =
Original file line number Diff line number Diff line change 1
1
// tag::traits[]
2
2
// src/script/scala/progscala3/basicoop/Exports.scala
3
3
4
- import java .net .URL
4
+ import java .net .{ URI , URL }
5
5
6
6
case class UserName (value : String ): // <1>
7
7
assert(value.length > 0 )
@@ -25,7 +25,7 @@ class DirectoryAuthenticate(location: URL) extends Authenticate:
25
25
// tag::service1[]
26
26
object ServiceWithoutExports :
27
27
private val dirAuthenticate =
28
- DirectoryAuthenticate (URL (" https://directory.wtf" ))
28
+ DirectoryAuthenticate (URI (" https://directory.wtf" ).toURL( ))
29
29
30
30
def authenticate (username : UserName , password : Password ): Boolean =
31
31
dirAuthenticate(username, password)
@@ -35,7 +35,7 @@ object ServiceWithoutExports:
35
35
// tag::service2[]
36
36
object Service :
37
37
private val dirAuthenticate =
38
- DirectoryAuthenticate (URL (" https://directory.wtf" ))
38
+ DirectoryAuthenticate (URI (" https://directory.wtf" ).toURL( ))
39
39
40
40
export dirAuthenticate .{isAuthenticated , apply as authenticate }
41
41
// end::service2[]
Original file line number Diff line number Diff line change 3
3
// This version of Exports.scala doesn't appear in the book, but it
4
4
// includes more examples of exporting parts of internal dependencies.
5
5
6
- import java .net .URL
6
+ import java .net .{ URI , URL }
7
7
8
8
case class UserName (value : String ):
9
9
assert(value.length > 0 )
@@ -41,7 +41,7 @@ class AsyncTokenizer extends AsyncWorker[String, Seq[String]]:
41
41
42
42
object ServiceWithoutExports :
43
43
private val dirAuthenticate =
44
- DirectoryAuthenticate (URL (" https://directory.wtf" ))
44
+ DirectoryAuthenticate (URI (" https://directory.wtf" ).toURL( ))
45
45
private val manager = ResourceManager (sys.env)
46
46
private val tokenizer = AsyncTokenizer ()
47
47
@@ -55,7 +55,7 @@ object ServiceWithoutExports:
55
55
// tag::service2[]
56
56
object Service :
57
57
private val dirAuthenticate =
58
- DirectoryAuthenticate (URL (" https://directory.wtf" ))
58
+ DirectoryAuthenticate (URI (" https://directory.wtf" ).toURL( ))
59
59
private val manager = ResourceManager (sys.env)
60
60
private val tokenizer = AsyncTokenizer ()
61
61
You can’t perform that action at this time.
0 commit comments