Skip to content

Commit

Permalink
Use java.io.File instead of java.nio.files.Path
Browse files Browse the repository at this point in the history
Closes #202
  • Loading branch information
fzhinkin committed Aug 10, 2023
1 parent ed46f51 commit 2cb1d7d
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions core/jvm/src/files/Paths.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,14 @@
package kotlinx.io.files

import kotlinx.io.*
import java.io.File
import java.io.FileInputStream
import java.io.FileOutputStream
import java.nio.file.*
import java.nio.file.Path as NioPath

public actual class Path internal constructor(internal val nioPath: NioPath)
public actual class Path internal constructor(internal val file: File)

public actual fun Path(path: String): Path = Path(Paths.get(path))
public actual fun Path(path: String): Path = Path(File(path))

public actual fun Path.source(): Source = FileInputStream(nioPath.toFile()).asSource().buffered()
public actual fun Path.source(): Source = FileInputStream(file).asSource().buffered()

public actual fun Path.sink(): Sink = FileOutputStream(nioPath.toFile()).asSink().buffered()
public actual fun Path.sink(): Sink = FileOutputStream(file).asSink().buffered()

0 comments on commit 2cb1d7d

Please sign in to comment.