Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move kotlinx.io.files package to a separate module #411

Open
wants to merge 7 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
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
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ which includes the `FileSystem` interface and its default implementation - `Syst

There are several `kotlinx-io` modules:
- [kotlinx-io-bytestring](./bytestring) - provides `ByteString`.
- [kotlinx-io-core](./core) - provides IO primitives (`Buffer`, `Source`, `Sink`), filesystems support, depends on `kotlinx-io-bytestring`.
- [kotlinx-io-okio](./integration/okio) - bridges `kotlinx-io` and `Okio` `ByteString`, `kotlinx.io.RawSource` and `okio.Source`, `kotlinx.io.RawSink` and `okio.Sink`.
- [kotlinx-io-core](./core) - provides IO primitives (`Buffer`, `Source`, `Sink`), depends on `kotlinx-io-bytestring`.
- [kotlinx-io-filesystem](./filesystem) - provides basic filesystem support, depends on `kotlinx-io-core`.
- [kotlinx-io-okio](./integration/okio) - bridges `kotlinx-io` and `Okio` `ByteString`, `kotlinx.io.RawSource` and `okio.Source`, `kotlinx.io.RawSink` and `okio.Sink`.

## Using in your projects

Expand Down Expand Up @@ -82,6 +83,7 @@ Add the library to dependencies:
On JVM, `kotlinx-io` supports Java Modules:
- `kotlinx-io-bytestring` library provides `kotlinx.io.bytestring` module;
- `kotlinx-io-core` library provides `kotlinx.io.core` module.
- `kotlinx-io-filesystem` library provides `kotlinx.io.filesystem` module.
- `kotlinx-io-okio` library provides `kotlinx.io.okio` module.

Read [this](https://kotlinlang.org/docs/gradle-configure-project.html#configure-with-java-modules-jpms-enabled) article
Expand Down
1 change: 1 addition & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ apiValidation {
dependencies {
kover(project(":kotlinx-io-core"))
kover(project(":kotlinx-io-bytestring"))
kover(project(":kotlinx-io-filesystem"))
kover(project(":kotlinx-io-okio"))
}

Expand Down
13 changes: 2 additions & 11 deletions core/Module.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,19 +75,10 @@ fun Message.Companion.fromBson(source: Source): Message {
}
```

# Package kotlinx.io

Core IO primitives.

# Package kotlinx.io.files

Basic API for working with files.

#### Thread-safety guarantees

Until stated otherwise, types and functions provided by the library are not thread safe.

#### Known issues
# Package kotlinx.io

- [#312](https://github.com/Kotlin/kotlinx-io/issues/312) For `wasmWasi` target, directory listing ([kotlinx.io.files.FileSystem.list]) does not work with NodeJS runtime on Windows,
as `fd_readdir` function is [not implemented there](https://github.com/nodejs/node/blob/6f4d6011ea1b448cf21f5d363c44e4a4c56ca34c/deps/uvwasi/src/uvwasi.c#L19).
Core IO primitives.
52 changes: 0 additions & 52 deletions core/api/kotlinx-io-core.api
Original file line number Diff line number Diff line change
Expand Up @@ -236,58 +236,6 @@ public final class kotlinx/io/Utf8Kt {
public static synthetic fun writeString$default (Lkotlinx/io/Sink;Ljava/lang/String;IIILjava/lang/Object;)V
}

public final class kotlinx/io/files/FileMetadata {
public fun <init> ()V
public fun <init> (ZZJ)V
public synthetic fun <init> (ZZJILkotlin/jvm/internal/DefaultConstructorMarker;)V
public final fun getSize ()J
public final fun isDirectory ()Z
public final fun isRegularFile ()Z
}

public abstract interface class kotlinx/io/files/FileSystem {
public abstract fun atomicMove (Lkotlinx/io/files/Path;Lkotlinx/io/files/Path;)V
public abstract fun createDirectories (Lkotlinx/io/files/Path;Z)V
public static synthetic fun createDirectories$default (Lkotlinx/io/files/FileSystem;Lkotlinx/io/files/Path;ZILjava/lang/Object;)V
public abstract fun delete (Lkotlinx/io/files/Path;Z)V
public static synthetic fun delete$default (Lkotlinx/io/files/FileSystem;Lkotlinx/io/files/Path;ZILjava/lang/Object;)V
public abstract fun exists (Lkotlinx/io/files/Path;)Z
public abstract fun list (Lkotlinx/io/files/Path;)Ljava/util/Collection;
public abstract fun metadataOrNull (Lkotlinx/io/files/Path;)Lkotlinx/io/files/FileMetadata;
public abstract fun resolve (Lkotlinx/io/files/Path;)Lkotlinx/io/files/Path;
public abstract fun sink (Lkotlinx/io/files/Path;Z)Lkotlinx/io/RawSink;
public static synthetic fun sink$default (Lkotlinx/io/files/FileSystem;Lkotlinx/io/files/Path;ZILjava/lang/Object;)Lkotlinx/io/RawSink;
public abstract fun source (Lkotlinx/io/files/Path;)Lkotlinx/io/RawSource;
}

public final class kotlinx/io/files/FileSystemJvmKt {
public static final field SystemFileSystem Lkotlinx/io/files/FileSystem;
public static final field SystemTemporaryDirectory Lkotlinx/io/files/Path;
}

public final class kotlinx/io/files/Path {
public fun equals (Ljava/lang/Object;)Z
public final fun getName ()Ljava/lang/String;
public final fun getParent ()Lkotlinx/io/files/Path;
public fun hashCode ()I
public final fun isAbsolute ()Z
public fun toString ()Ljava/lang/String;
}

public final class kotlinx/io/files/PathsJvmKt {
public static final field SystemPathSeparator C
public static final fun Path (Ljava/lang/String;)Lkotlinx/io/files/Path;
public static final fun sink (Lkotlinx/io/files/Path;)Lkotlinx/io/Sink;
public static final fun source (Lkotlinx/io/files/Path;)Lkotlinx/io/Source;
}

public final class kotlinx/io/files/PathsKt {
public static final fun Path (Ljava/lang/String;[Ljava/lang/String;)Lkotlinx/io/files/Path;
public static final fun Path (Lkotlinx/io/files/Path;[Ljava/lang/String;)Lkotlinx/io/files/Path;
public static final fun sinkDeprecated (Lkotlinx/io/files/Path;)Lkotlinx/io/Sink;
public static final fun sourceDeprecated (Lkotlinx/io/files/Path;)Lkotlinx/io/Source;
}

public abstract interface class kotlinx/io/unsafe/BufferIterationContext : kotlinx/io/unsafe/SegmentReadContext {
public abstract fun next (Lkotlinx/io/Segment;)Lkotlinx/io/Segment;
}
Expand Down
51 changes: 0 additions & 51 deletions core/api/kotlinx-io-core.klib.api
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,6 @@ abstract interface kotlinx.io/RawSource : kotlin/AutoCloseable { // kotlinx.io/R
abstract fun readAtMostTo(kotlinx.io/Buffer, kotlin/Long): kotlin/Long // kotlinx.io/RawSource.readAtMostTo|readAtMostTo(kotlinx.io.Buffer;kotlin.Long){}[0]
}

sealed interface kotlinx.io.files/FileSystem { // kotlinx.io.files/FileSystem|null[0]
abstract fun atomicMove(kotlinx.io.files/Path, kotlinx.io.files/Path) // kotlinx.io.files/FileSystem.atomicMove|atomicMove(kotlinx.io.files.Path;kotlinx.io.files.Path){}[0]
abstract fun createDirectories(kotlinx.io.files/Path, kotlin/Boolean = ...) // kotlinx.io.files/FileSystem.createDirectories|createDirectories(kotlinx.io.files.Path;kotlin.Boolean){}[0]
abstract fun delete(kotlinx.io.files/Path, kotlin/Boolean = ...) // kotlinx.io.files/FileSystem.delete|delete(kotlinx.io.files.Path;kotlin.Boolean){}[0]
abstract fun exists(kotlinx.io.files/Path): kotlin/Boolean // kotlinx.io.files/FileSystem.exists|exists(kotlinx.io.files.Path){}[0]
abstract fun list(kotlinx.io.files/Path): kotlin.collections/Collection<kotlinx.io.files/Path> // kotlinx.io.files/FileSystem.list|list(kotlinx.io.files.Path){}[0]
abstract fun metadataOrNull(kotlinx.io.files/Path): kotlinx.io.files/FileMetadata? // kotlinx.io.files/FileSystem.metadataOrNull|metadataOrNull(kotlinx.io.files.Path){}[0]
abstract fun resolve(kotlinx.io.files/Path): kotlinx.io.files/Path // kotlinx.io.files/FileSystem.resolve|resolve(kotlinx.io.files.Path){}[0]
abstract fun sink(kotlinx.io.files/Path, kotlin/Boolean = ...): kotlinx.io/RawSink // kotlinx.io.files/FileSystem.sink|sink(kotlinx.io.files.Path;kotlin.Boolean){}[0]
abstract fun source(kotlinx.io.files/Path): kotlinx.io/RawSource // kotlinx.io.files/FileSystem.source|source(kotlinx.io.files.Path){}[0]
}

sealed interface kotlinx.io/Sink : kotlinx.io/RawSink { // kotlinx.io/Sink|null[0]
abstract val buffer // kotlinx.io/Sink.buffer|{}buffer[0]
abstract fun <get-buffer>(): kotlinx.io/Buffer // kotlinx.io/Sink.buffer.<get-buffer>|<get-buffer>(){}[0]
Expand Down Expand Up @@ -91,30 +79,6 @@ sealed interface kotlinx.io/Source : kotlinx.io/RawSource { // kotlinx.io/Source
abstract fun transferTo(kotlinx.io/RawSink): kotlin/Long // kotlinx.io/Source.transferTo|transferTo(kotlinx.io.RawSink){}[0]
}

final class kotlinx.io.files/FileMetadata { // kotlinx.io.files/FileMetadata|null[0]
constructor <init>(kotlin/Boolean = ..., kotlin/Boolean = ..., kotlin/Long = ...) // kotlinx.io.files/FileMetadata.<init>|<init>(kotlin.Boolean;kotlin.Boolean;kotlin.Long){}[0]

final val isDirectory // kotlinx.io.files/FileMetadata.isDirectory|{}isDirectory[0]
final fun <get-isDirectory>(): kotlin/Boolean // kotlinx.io.files/FileMetadata.isDirectory.<get-isDirectory>|<get-isDirectory>(){}[0]
final val isRegularFile // kotlinx.io.files/FileMetadata.isRegularFile|{}isRegularFile[0]
final fun <get-isRegularFile>(): kotlin/Boolean // kotlinx.io.files/FileMetadata.isRegularFile.<get-isRegularFile>|<get-isRegularFile>(){}[0]
final val size // kotlinx.io.files/FileMetadata.size|{}size[0]
final fun <get-size>(): kotlin/Long // kotlinx.io.files/FileMetadata.size.<get-size>|<get-size>(){}[0]
}

final class kotlinx.io.files/Path { // kotlinx.io.files/Path|null[0]
final val isAbsolute // kotlinx.io.files/Path.isAbsolute|{}isAbsolute[0]
final fun <get-isAbsolute>(): kotlin/Boolean // kotlinx.io.files/Path.isAbsolute.<get-isAbsolute>|<get-isAbsolute>(){}[0]
final val name // kotlinx.io.files/Path.name|{}name[0]
final fun <get-name>(): kotlin/String // kotlinx.io.files/Path.name.<get-name>|<get-name>(){}[0]
final val parent // kotlinx.io.files/Path.parent|{}parent[0]
final fun <get-parent>(): kotlinx.io.files/Path? // kotlinx.io.files/Path.parent.<get-parent>|<get-parent>(){}[0]

final fun equals(kotlin/Any?): kotlin/Boolean // kotlinx.io.files/Path.equals|equals(kotlin.Any?){}[0]
final fun hashCode(): kotlin/Int // kotlinx.io.files/Path.hashCode|hashCode(){}[0]
final fun toString(): kotlin/String // kotlinx.io.files/Path.toString|toString(){}[0]
}

final class kotlinx.io/Buffer : kotlinx.io/Sink, kotlinx.io/Source { // kotlinx.io/Buffer|null[0]
constructor <init>() // kotlinx.io/Buffer.<init>|<init>(){}[0]

Expand Down Expand Up @@ -190,10 +154,6 @@ final class kotlinx.io/Segment { // kotlinx.io/Segment|null[0]
final fun writeBackData(kotlin/ByteArray, kotlin/Int) // kotlinx.io/Segment.writeBackData|writeBackData(kotlin.ByteArray;kotlin.Int){}[0]
}

open class kotlinx.io.files/FileNotFoundException : kotlinx.io/IOException { // kotlinx.io.files/FileNotFoundException|null[0]
constructor <init>(kotlin/String?) // kotlinx.io.files/FileNotFoundException.<init>|<init>(kotlin.String?){}[0]
}

open class kotlinx.io/EOFException : kotlinx.io/IOException { // kotlinx.io/EOFException|null[0]
constructor <init>() // kotlinx.io/EOFException.<init>|<init>(){}[0]
constructor <init>(kotlin/String?) // kotlinx.io/EOFException.<init>|<init>(kotlin.String?){}[0]
Expand Down Expand Up @@ -221,21 +181,13 @@ final object kotlinx.io.unsafe/UnsafeBufferOperations { // kotlinx.io.unsafe/Uns
final inline fun writeToTail(kotlinx.io/Buffer, kotlin/Int, kotlin/Function3<kotlin/ByteArray, kotlin/Int, kotlin/Int, kotlin/Int>): kotlin/Int // kotlinx.io.unsafe/UnsafeBufferOperations.writeToTail|writeToTail(kotlinx.io.Buffer;kotlin.Int;kotlin.Function3<kotlin.ByteArray,kotlin.Int,kotlin.Int,kotlin.Int>){}[0]
}

final val kotlinx.io.files/SystemFileSystem // kotlinx.io.files/SystemFileSystem|{}SystemFileSystem[0]
final fun <get-SystemFileSystem>(): kotlinx.io.files/FileSystem // kotlinx.io.files/SystemFileSystem.<get-SystemFileSystem>|<get-SystemFileSystem>(){}[0]
final val kotlinx.io.files/SystemPathSeparator // kotlinx.io.files/SystemPathSeparator|{}SystemPathSeparator[0]
final fun <get-SystemPathSeparator>(): kotlin/Char // kotlinx.io.files/SystemPathSeparator.<get-SystemPathSeparator>|<get-SystemPathSeparator>(){}[0]
final val kotlinx.io.files/SystemTemporaryDirectory // kotlinx.io.files/SystemTemporaryDirectory|{}SystemTemporaryDirectory[0]
final fun <get-SystemTemporaryDirectory>(): kotlinx.io.files/Path // kotlinx.io.files/SystemTemporaryDirectory.<get-SystemTemporaryDirectory>|<get-SystemTemporaryDirectory>(){}[0]
final val kotlinx.io.unsafe/BufferIterationContextImpl // kotlinx.io.unsafe/BufferIterationContextImpl|{}BufferIterationContextImpl[0]
final fun <get-BufferIterationContextImpl>(): kotlinx.io.unsafe/BufferIterationContext // kotlinx.io.unsafe/BufferIterationContextImpl.<get-BufferIterationContextImpl>|<get-BufferIterationContextImpl>(){}[0]
final val kotlinx.io.unsafe/SegmentReadContextImpl // kotlinx.io.unsafe/SegmentReadContextImpl|{}SegmentReadContextImpl[0]
final fun <get-SegmentReadContextImpl>(): kotlinx.io.unsafe/SegmentReadContext // kotlinx.io.unsafe/SegmentReadContextImpl.<get-SegmentReadContextImpl>|<get-SegmentReadContextImpl>(){}[0]
final val kotlinx.io.unsafe/SegmentWriteContextImpl // kotlinx.io.unsafe/SegmentWriteContextImpl|{}SegmentWriteContextImpl[0]
final fun <get-SegmentWriteContextImpl>(): kotlinx.io.unsafe/SegmentWriteContext // kotlinx.io.unsafe/SegmentWriteContextImpl.<get-SegmentWriteContextImpl>|<get-SegmentWriteContextImpl>(){}[0]

final fun (kotlinx.io.files/Path).kotlinx.io.files/sink(): kotlinx.io/Sink // kotlinx.io.files/sink|[email protected](){}[0]
final fun (kotlinx.io.files/Path).kotlinx.io.files/source(): kotlinx.io/Source // kotlinx.io.files/source|[email protected](){}[0]
final fun (kotlinx.io/Buffer).kotlinx.io/indexOf(kotlin/Byte, kotlin/Long = ..., kotlin/Long = ...): kotlin/Long // kotlinx.io/indexOf|[email protected](kotlin.Byte;kotlin.Long;kotlin.Long){}[0]
final fun (kotlinx.io/Buffer).kotlinx.io/indexOf(kotlinx.io.bytestring/ByteString, kotlin/Long = ...): kotlin/Long // kotlinx.io/indexOf|[email protected](kotlinx.io.bytestring.ByteString;kotlin.Long){}[0]
final fun (kotlinx.io/Buffer).kotlinx.io/readString(): kotlin/String // kotlinx.io/readString|[email protected](){}[0]
Expand Down Expand Up @@ -292,9 +244,6 @@ final fun (kotlinx.io/Source).kotlinx.io/readULongLe(): kotlin/ULong // kotlinx.
final fun (kotlinx.io/Source).kotlinx.io/readUShort(): kotlin/UShort // kotlinx.io/readUShort|[email protected](){}[0]
final fun (kotlinx.io/Source).kotlinx.io/readUShortLe(): kotlin/UShort // kotlinx.io/readUShortLe|[email protected](){}[0]
final fun (kotlinx.io/Source).kotlinx.io/startsWith(kotlin/Byte): kotlin/Boolean // kotlinx.io/startsWith|[email protected](kotlin.Byte){}[0]
final fun kotlinx.io.files/Path(kotlin/String): kotlinx.io.files/Path // kotlinx.io.files/Path|Path(kotlin.String){}[0]
final fun kotlinx.io.files/Path(kotlin/String, kotlin/Array<out kotlin/String>...): kotlinx.io.files/Path // kotlinx.io.files/Path|Path(kotlin.String;kotlin.Array<out|kotlin.String>...){}[0]
final fun kotlinx.io.files/Path(kotlinx.io.files/Path, kotlin/Array<out kotlin/String>...): kotlinx.io.files/Path // kotlinx.io.files/Path|Path(kotlinx.io.files.Path;kotlin.Array<out|kotlin.String>...){}[0]
final fun kotlinx.io/discardingSink(): kotlinx.io/RawSink // kotlinx.io/discardingSink|discardingSink(){}[0]
final inline fun (kotlinx.io.unsafe/SegmentReadContext).kotlinx.io.unsafe/withData(kotlinx.io/Segment, kotlin/Function3<kotlin/ByteArray, kotlin/Int, kotlin/Int, kotlin/Unit>) // kotlinx.io.unsafe/withData|[email protected](kotlinx.io.Segment;kotlin.Function3<kotlin.ByteArray,kotlin.Int,kotlin.Int,kotlin.Unit>){}[0]
final inline fun (kotlinx.io/Sink).kotlinx.io/writeToInternalBuffer(kotlin/Function1<kotlinx.io/Buffer, kotlin/Unit>) // kotlinx.io/writeToInternalBuffer|[email protected](kotlin.Function1<kotlinx.io.Buffer,kotlin.Unit>){}[0]
Expand Down
22 changes: 0 additions & 22 deletions core/apple/test/NSInputStreamSourceTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,7 @@
*/

package kotlinx.io

import kotlinx.io.files.Path
import kotlinx.io.files.SystemFileSystem
import platform.Foundation.NSInputStream
import platform.Foundation.NSURL
import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.assertFailsWith
Expand All @@ -23,24 +19,6 @@ class NSInputStreamSourceTest {
assertEquals("a", buffer.readString())
}

@Test
fun nsInputStreamSourceFromFile() {
val file = tempFileName()
try {
SystemFileSystem.sink(Path(file)).buffered().use {
it.writeString("example")
}

val input = NSInputStream(uRL = NSURL.fileURLWithPath(file))
val source = input.asSource()
val buffer = Buffer()
assertEquals(7, source.readAtMostTo(buffer, 10))
assertEquals("example", buffer.readString())
} finally {
SystemFileSystem.delete(Path(file))
}
}

@Test
fun sourceFromInputStream() {
val input = NSInputStream(data = ("a" + "b".repeat(Segment.SIZE * 2) + "c").encodeToByteArray().toNSData())
Expand Down
41 changes: 0 additions & 41 deletions core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
* Use of this source code is governed by the Apache 2.0 license that can be found in the LICENCE file.
*/

import org.gradle.internal.os.OperatingSystem
import org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl

plugins {
id("kotlinx-io-multiplatform")
id("kotlinx-io-publish")
Expand All @@ -31,18 +28,6 @@ kotlin {
}
}
}
@OptIn(ExperimentalWasmDsl::class)
wasmWasi {
nodejs {
testTask {
// fd_readdir is unsupported on Windows:
// https://github.com/nodejs/node/blob/6f4d6011ea1b448cf21f5d363c44e4a4c56ca34c/deps/uvwasi/src/uvwasi.c#L19
if (OperatingSystem.current().isWindows) {
filter.setExcludePatterns("*SmokeFileTest.listDirectory")
}
}
}
}

sourceSets {
commonMain.dependencies {
Expand All @@ -54,32 +39,6 @@ kotlin {
}
}

tasks.named("wasmWasiNodeTest") {
// TODO: remove once https://youtrack.jetbrains.com/issue/KT-65179 solved
doFirst {
val layout = project.layout
val templateFile = layout.projectDirectory.file("wasmWasi/test/test-driver.mjs.template").asFile

val driverFile = layout.buildDirectory.file(
"compileSync/wasmWasi/test/testDevelopmentExecutable/kotlin/kotlinx-io-kotlinx-io-core-wasm-wasi-test.mjs"
)

fun File.mkdirsAndEscape(): String {
mkdirs()
return absolutePath.replace("\\", "\\\\")
}

val tmpDir = temporaryDir.resolve("kotlinx-io-core-wasi-test").mkdirsAndEscape()
val tmpDir2 = temporaryDir.resolve("kotlinx-io-core-wasi-test-2").mkdirsAndEscape()

val newDriver = templateFile.readText()
.replace("<SYSTEM_TEMP_DIR>", tmpDir, false)
.replace("<SYSTEM_TEMP_DIR2>", tmpDir2, false)

driverFile.get().asFile.writeText(newDriver)
}
}

animalsniffer {
annotation = "kotlinx.io.files.AnimalSnifferIgnore"
}
2 changes: 0 additions & 2 deletions core/common/test/util.kt
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ fun assertNoEmptySegments(buffer: Buffer) {
assertTrue(segmentSizes(buffer).all { it != 0 }, "Expected all segments to be non-empty")
}

expect fun tempFileName(): String

private fun fromHexChar(char: Char): Int {
val code = char.code
return when (code) {
Expand Down
9 changes: 0 additions & 9 deletions core/js/src/-PlatformJs.kt
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,3 @@ public actual open class EOFException : IOException {

public constructor(message: String?, cause: Throwable?) : super(message, cause)
}

internal actual fun withCaughtException(block: () -> Unit): Throwable? {
try {
block()
return null
} catch (t: Throwable) {
return t
}
}
1 change: 0 additions & 1 deletion core/jvm/module/module-info.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@
requires transitive kotlinx.io.bytestring;

exports kotlinx.io;
exports kotlinx.io.files;
exports kotlinx.io.unsafe;
}
15 changes: 0 additions & 15 deletions core/jvm/test/utilJVM.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,8 @@
*/
package kotlinx.io

import kotlinx.io.files.SystemTemporaryDirectory
import java.io.File
import kotlin.random.Random
import kotlin.test.assertEquals

@OptIn(ExperimentalStdlibApi::class)
actual fun tempFileName(): String {
val tmpDir = SystemTemporaryDirectory.file
while (true) {
val randomString = Random.nextBytes(32).toHexString()
val res = File(tmpDir, randomString)
if (!res.exists()) {
return res.absolutePath
}
}
}

fun assertByteArrayEquals(expectedUtf8: String, b: ByteArray) {
assertEquals(expectedUtf8, b.toString(Charsets.UTF_8))
}
Expand Down
Loading