https://github.com/fleeksoft/fleeksoft-io
A lightweight Kotlin Multiplatform port of JDK IO classes (Reader, InputStream, BufferedReader, etc.), with support for character encoding via Charset.
https://github.com/fleeksoft/fleeksoft-io
jdk kotlin kotlin-io kotlin-multiplatform
Last synced: 27 days ago
JSON representation
A lightweight Kotlin Multiplatform port of JDK IO classes (Reader, InputStream, BufferedReader, etc.), with support for character encoding via Charset.
- Host: GitHub
- URL: https://github.com/fleeksoft/fleeksoft-io
- Owner: fleeksoft
- License: apache-2.0
- Created: 2024-10-19T11:42:54.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2025-04-28T07:46:46.000Z (about 1 month ago)
- Last Synced: 2025-05-01T03:42:57.064Z (about 1 month ago)
- Topics: jdk, kotlin, kotlin-io, kotlin-multiplatform
- Language: Kotlin
- Homepage:
- Size: 2.04 MB
- Stars: 72
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# 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.
[](https://kotlinlang.org)

[](https://central.sonatype.com/artifact/com.fleeksoft.io/io)
---
## π Supported Platforms









---
## β¨ 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 components for buffer and charset management.
- `Buffer`: Base container (like `java.nio.Buffer`)
- `ByteBuffer`, `CharBuffer`
- `CharBufferFactory`: Helper utilities to create buffers
- `Closeable`, `Readable`: Interfaces for IO components---
### π¦ IO Module (`com.fleeksoft.io:io`)
Stream and reader abstractions.
- **Character Streams**
- `Reader`, `BufferedReader`, `StringReader`, `CharArrayReader`
- `PushbackReader`, `FilterReader`
- **Byte Streams**
- `InputStream`, `ByteArrayInputStream`, `InputStreamReader`
- `OutputStream`, `ByteArrayOutputStream`, `BufferedOutputStream`, `FilterOutputStream`
- **Charset Support** [CharsetsReadme.md](CharsetsReadme.md)
- **Extension Functions**
```kotlin
"Hello".byteInputStream() // return ByteArrayInputStream
"Hello".reader() // return StringReader
byteArray.inputStream() // return ByteArrayInputStream
inputStream.reader() // return InputStreamReader
inputStream.bufferedReader() // return BufferedReader
reader.buffered() // return BufferedReader
reader.buffered().readLines()
bufferedReader.readString(count)```---
---
### π 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:`
- Extended: `com.fleeksoft.charset:charset-ext:`β‘οΈ [More info](CharsetsReadme.md)
---
## π Installation
Add dependencies in your `build.gradle.kts`:
```kotlin
commonMain.dependencies {
implementation("com.fleeksoft.io:io-core:")
implementation("com.fleeksoft.io:io:")// Optional integrations
implementation("com.fleeksoft.io:kotlinx-io:")
implementation("com.fleeksoft.io:okio:")
}
```Find the latest version here:
[](https://central.sonatype.com/artifact/com.fleeksoft.io/io)
---## π Usage Example
```kotlin
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](LICENSE.md) for full details.