fleeksoft-io

Port of JDK's IO classes for cross-platform support, facilitating Java-style IO operations. Offers modules for buffer, charset, URI handling, and seamless integration with kotlinx-io and Okio.

Android JVMJVMKotlin/NativeWasmJS
GitHub stars81
Authorsfleeksoft
Open issues0
LicenseApache License 2.0
Creation dateover 1 year ago

Last activity21 days ago
Latest release0.0.8 (about 1 month ago)

Kotlin Multiplatform IO Library

A Kotlin Multiplatform (KMP) port of Java’s IO classes, bringing familiar IO operations to multiplatform projectsβ€”JVM, Android, iOS, macOS, Linux, Windows, Web, and beyond.

Kotlin License Maven Central

🌐 Supported Platforms

badge-jvm badge-android badge-ios badge-mac badge-tvos badge-tvos badge-linux badge-windows badge-js badge-wasm


✨ Features

This library is organized into modular components for flexibility and clarity.

Note Direct file read/write APIs are not included. For file operations, use this library in combination with kotlinx-io or okio, which support stream conversions.


🧱 Core Module (com.fleeksoft.io:io-core)

Core buffers plus the main stream/reader implementations and extensions.

  • Buffer: Base container (like java.nio.Buffer)
  • ByteBuffer, CharBuffer
  • ByteBufferFactory, CharBufferFactory: Helper utilities to create buffers
  • InputStream, OutputStream, Reader, BufferedReader
  • ByteArrayInputStream, ByteArrayOutputStream, BufferedInputStream, BufferedOutputStream
  • FilterInputStream, FilterOutputStream, FilterReader, PushbackReader
  • StringReader, CharArrayReader
  • Closeable, Readable, Flushable: Interfaces for IO components
  • Core Extensions
    • "Hello".byteInputStream(), "Hello".reader()
    • byteArray.inputStream()
    • reader.buffered(), reader.readLines(), reader.readString(count)

πŸ“¦ IO Module (com.fleeksoft.io:io)

Charset-aware reader adapter and InputStream extensions.

  • InputStreamReader
  • Charset Support CharsetsReadme.md
  • Stream Extensions
    val byteArrayInputStream: ByteArrayInputStream = "...".byteInputStream(Charsets.UTF8) 
    val inputStreamReader: InputStreamReader = inputStream.reader(Charsets.UTF8) // return InputStreamReader
    val bufferReader: BufferedReader = inputStream.bufferedReader(Charsets.UTF8) // return BufferedReader


🌐 URI Module (com.fleeksoft.io:uri)

Multiplatform-safe version of java.net.URI.

  • URI: Parse, resolve, normalize URIs
  • URIFactory: Use this instead of URI.create()

πŸ”Œ kotlinx-io Integration (com.fleeksoft.io:kotlinx-io)

Interop for working with kotlinx-io streams:

  • Source.asInputStream(): InputStream
  • RawSource.asInputStream(): InputStream
  • InputStream.asSource(): RawSource

πŸ”Œ Okio Integration (com.fleeksoft.io:okio)

Interop for Okio-powered IO:

  • Source.asInputStream(): InputStream
  • InputStream.asSource(): Source

🧬 Charset Modules

Support for standard and extended character sets:

  • Standard: com.fleeksoft.charset:charset:<version>
  • Extended: com.fleeksoft.charset:charset-ext:<version>

➑️ More info


πŸ›  Installation

Add dependencies in your build.gradle.kts:

commonMain.dependencies {
    implementation("com.fleeksoft.io:io-core:<version>")
    implementation("com.fleeksoft.io:io:<version>")

    // Optional integrations
    implementation("com.fleeksoft.io:kotlinx-io:<version>")
    implementation("com.fleeksoft.io:okio:<version>")
}

Find the latest version here: Maven Central

πŸš€ Usage Example

val str = "Hello, World!"
val byteArray = ByteArray(10)
val charArray = CharArray(10)

val byteArrayInputStream = str.byteInputStream()
val stringReader = str.reader()

val bufferedReader = stringReader.buffered()
val bufferedReader2 = byteArrayInputStream.bufferedReader()

val byteBuffer = ByteBufferFactory.wrap(byteArray)
val charBuffer = CharBufferFactory.wrap(charArray)

🀝 Contributing

Contributions are welcome! Open an issue or submit a pull request to improve features, fix bugs, or enhance documentation.

πŸ“„ License

Licensed under the Apache License 2.0. See LICENSE for full details.

Android JVMJVMKotlin/NativeWasmJS
GitHub stars81
Authorsfleeksoft
Open issues0
LicenseApache License 2.0
Creation dateover 1 year ago

Last activity21 days ago
Latest release0.0.8 (about 1 month ago)

Kotlin Multiplatform IO Library

A Kotlin Multiplatform (KMP) port of Java’s IO classes, bringing familiar IO operations to multiplatform projectsβ€”JVM, Android, iOS, macOS, Linux, Windows, Web, and beyond.

Kotlin License Maven Central

🌐 Supported Platforms

badge-jvm badge-android badge-ios badge-mac badge-tvos badge-tvos badge-linux badge-windows badge-js badge-wasm


✨ Features

This library is organized into modular components for flexibility and clarity.

Note Direct file read/write APIs are not included. For file operations, use this library in combination with kotlinx-io or okio, which support stream conversions.


🧱 Core Module (com.fleeksoft.io:io-core)

Core buffers plus the main stream/reader implementations and extensions.

  • Buffer: Base container (like java.nio.Buffer)
  • ByteBuffer, CharBuffer
  • ByteBufferFactory, CharBufferFactory: Helper utilities to create buffers
  • InputStream, OutputStream, Reader, BufferedReader
  • ByteArrayInputStream, ByteArrayOutputStream, BufferedInputStream, BufferedOutputStream
  • FilterInputStream, FilterOutputStream, FilterReader, PushbackReader
  • StringReader, CharArrayReader
  • Closeable, Readable, Flushable: Interfaces for IO components
  • Core Extensions
    • "Hello".byteInputStream(), "Hello".reader()
    • byteArray.inputStream()
    • reader.buffered(), reader.readLines(), reader.readString(count)

πŸ“¦ IO Module (com.fleeksoft.io:io)

Charset-aware reader adapter and InputStream extensions.

  • InputStreamReader
  • Charset Support CharsetsReadme.md
  • Stream Extensions
    val byteArrayInputStream: ByteArrayInputStream = "...".byteInputStream(Charsets.UTF8) 
    val inputStreamReader: InputStreamReader = inputStream.reader(Charsets.UTF8) // return InputStreamReader
    val bufferReader: BufferedReader = inputStream.bufferedReader(Charsets.UTF8) // return BufferedReader


🌐 URI Module (com.fleeksoft.io:uri)

Multiplatform-safe version of java.net.URI.

  • URI: Parse, resolve, normalize URIs
  • URIFactory: Use this instead of URI.create()

πŸ”Œ kotlinx-io Integration (com.fleeksoft.io:kotlinx-io)

Interop for working with kotlinx-io streams:

  • Source.asInputStream(): InputStream
  • RawSource.asInputStream(): InputStream
  • InputStream.asSource(): RawSource

πŸ”Œ Okio Integration (com.fleeksoft.io:okio)

Interop for Okio-powered IO:

  • Source.asInputStream(): InputStream
  • InputStream.asSource(): Source

🧬 Charset Modules

Support for standard and extended character sets:

  • Standard: com.fleeksoft.charset:charset:<version>
  • Extended: com.fleeksoft.charset:charset-ext:<version>

➑️ More info


πŸ›  Installation

Add dependencies in your build.gradle.kts:

commonMain.dependencies {
    implementation("com.fleeksoft.io:io-core:<version>")
    implementation("com.fleeksoft.io:io:<version>")

    // Optional integrations
    implementation("com.fleeksoft.io:kotlinx-io:<version>")
    implementation("com.fleeksoft.io:okio:<version>")
}

Find the latest version here: Maven Central

πŸš€ Usage Example

val str = "Hello, World!"
val byteArray = ByteArray(10)
val charArray = CharArray(10)

val byteArrayInputStream = str.byteInputStream()
val stringReader = str.reader()

val bufferedReader = stringReader.buffered()
val bufferedReader2 = byteArrayInputStream.bufferedReader()

val byteBuffer = ByteBufferFactory.wrap(byteArray)
val charBuffer = CharBufferFactory.wrap(charArray)

🀝 Contributing

Contributions are welcome! Open an issue or submit a pull request to improve features, fix bugs, or enhance documentation.

πŸ“„ License

Licensed under the Apache License 2.0. See LICENSE for full details.