Git Product home page Git Product logo

kotlinx-io's Introduction

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

kotlinx-io is built around Buffer - a mutable sequence of bytes.

Buffer works like a queue, allowing to read data from its head or to write data to its tail. Buffer provides functions to read and write data of different built-in types, and to copy data to or from other Buffers. Depending on the target platform, extension functions allowing data exchange with platform-specific types are also available.

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

kotlinx-io provides interfaces representing data sources and destinations - Source and Sink, and in addition to the mutable Buffer the library also provides an immutable sequence of bytes - ByteString.

An experimental filesystem support is shipped under the kotlinx.io.files package, which includes the FileSystem interface and its default implementation - SystemFileSystem.

FileSystem provides basic operations for working with files and directories, which are represented by yet another class under the same package - Path.

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 the library to dependencies:

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

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

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

Maven

Add the library to dependencies:

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

Android

kotlinx-io is not tested on Android on a regular basis, but the library is compatible with Android 5.0+ (API level 21+).

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.

An 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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.