Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions fxgl-io/src/main/kotlin/com/almasb/fxgl/net/NetService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import javafx.beans.property.ReadOnlyDoubleProperty
import javafx.beans.property.ReadOnlyDoubleWrapper
import java.io.InputStream
import java.io.OutputStream
import java.net.URI
import java.net.URL
import java.nio.file.Files
import java.nio.file.Path
Expand All @@ -40,7 +41,7 @@ class NetService : EngineService() {
* @return task that provides stream access to given link
*/
fun openStreamTask(url: String): IOTask<InputStream> = IOTask.of("openStream($url)") {
URL(url).openStream()
URI(url).toURL().openStream()
}

fun newTCPServer(port: Int): Server<Bundle> = TCPServer(port, Bundle::class.java)
Expand Down Expand Up @@ -111,7 +112,7 @@ class NetService : EngineService() {
) : IOTask<Path>("DownloadTask($urlString, $fileName)") {

override fun onExecute(): Path {
val url = URL(urlString)
val url = URI.create(urlString).toURL()
val file = Paths.get(fileName)

val connection = url.openConnection()
Expand Down