Skip to content

wldeh/kotlinx-io

 
 

Repository files navigation

kotlinx-io

Kotlin Alpha JetBrains incubator project GitHub license Download Kotlin TeamCity build KDoc link

A multiplatform Kotlin library providing basic IO primitives. kotlinx-io is based on Okio but does not preserve backward compatibility with it.

Overview

The library is built around Buffer - a mutable sequence of bytes. Buffer works like a queue allowing one to read data from its head or write data to its tail.

Buffer provides functions to read and write data of different built-in types and copy data to or from other buffers. Depending on a target platform, extension functions allowing data exchange with platform-specific types are also provided.

Buffer consists of segments organized as a linked list. Segments allow reducing memory allocations during the buffer's expansion and copying. The latter is achieved by delegating or sharing the ownership over the underlying buffer's segments with other buffers.

The library also provides interfaces representing data sources and destinations - Source and Sink.

In addition to Buffer, the library provides an immutable sequence of bytes - ByteString.

There are two kotlinx-io modules:

Using in your projects

Note that the library is experimental, and the API is subject to change.

Gradle

Make sure that you have mavenCentral() in the list of repositories:

repositories {
    mavenCentral()
}

Add libraries to dependencies:

dependencies {
    implementation("org.jetbrains.kotlinx:kotlinx-io-core:0.2.0")
    implementation("org.jetbrains.kotlinx:kotlinx-io-bytestring:0.2.0")
}

In multiplatform projects, add a dependency to the commonMain source set dependencies:

kotlin {
    sourceSets {
        commonMain {
            dependencies {
                implementation("org.jetbrains.kotlinx:kotlinx-io-core:0.2.0")
                implementation("org.jetbrains.kotlinx:kotlinx-io-bytestring:0.2.0")
            }
        }
    }
}

Maven

Add libraries to dependencies:

<dependency>
    <groupId>org.jetbrains.kotlinx</groupId>
    <artifactId>kotlinx-io-core-jvm</artifactId>
    <version>0.2.0</version>
</dependency>
<dependency>
    <groupId>org.jetbrains.kotlinx</groupId>
    <artifactId>kotlinx-io-bytestring-jvm</artifactId>
    <version>0.2.0</version>
</dependency>

Contributing

Read the Contributing Guidelines.

Code of Conduct

This project and the corresponding community are governed by the JetBrains Open Source and Community Code of Conduct. Please make sure you read it.

License

kotlinx-io is licensed under the Apache 2.0 License.

Credits

Thanks to everyone involved in the project.

A honorable mention goes to the developers of Okio that served as the foundation for kotlinx-io and to Jesse Wilson, for the help with Okio adaption, his suggestions, assistance and guidance with kotlinx-io development.

About

Kotlin multiplatform I/O library

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Kotlin 100.0%