Skip to content
Merged
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
5 changes: 5 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ gradle-kmp-configuration = "0.5.2"
gradle-kotlin = "2.2.21"
gradle-publish-maven = "0.35.0"

kotlinx-coroutines = "1.10.2"

[libraries]
benchmark-runtime = { module = "org.jetbrains.kotlinx:kotlinx-benchmark-runtime", version.ref = "gradle-benchmark" }

Expand All @@ -14,6 +16,9 @@ gradle-kmp-configuration = { module = "io.matthewnelson:gradle-kmp-configurat
gradle-kotlin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "gradle-kotlin" }
gradle-publish-maven = { module = "com.vanniktech:gradle-maven-publish-plugin", version.ref = "gradle-publish-maven" }

# tests
kotlinx-coroutines-test = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-test", version.ref = "kotlinx-coroutines" }

[plugins]
benchmark = { id = "org.jetbrains.kotlinx.benchmark", version.ref = "gradle-benchmark" }
binary-compat = { id = "org.jetbrains.kotlinx.binary-compatibility-validator", version.ref = "gradle-binary-compat" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,9 +263,9 @@ public class Base32CrockfordConfigBuilder {
* }.newEncoderFeed { encodedChar ->
* sb.append(encodedChar)
* }.use { feed ->
* bytes1.forEach { b -> feed.consume(b) }
* bytes1.forEach(feed::consume)
* feed.flush()
* bytes2.forEach { b -> feed.consume(b) }
* bytes2.forEach(feed::consume)
* }
* println(sb.toString())
* // 91JP-RV3F-*41BP-YWKC-CGGG-*
Expand All @@ -280,9 +280,9 @@ public class Base32CrockfordConfigBuilder {
* }.newEncoderFeed { encodedChar ->
* sb.append(encodedChar)
* }.use { feed ->
* bytes1.forEach { b -> feed.consume(b) }
* bytes1.forEach(feed::consume)
* feed.flush()
* bytes2.forEach { b -> feed.consume(b) }
* bytes2.forEach(feed::consume)
* }
* println(sb.toString())
* // 91JP-RV3F-41BP-YWKC-CGGG-*
Expand Down
8 changes: 4 additions & 4 deletions library/core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ fun main() {

Base64.Default.newEncoderFeed(outN).use { feed ->
// Encode UTF-8 bytes to base64
"Hello World 1!".decodeToByteArray(UTF8).forEach { b -> feed.consume(b) }
"Hello World 1!".decodeToByteArray(UTF8).forEach(feed::consume)
feed.flush() // Finalize first encoding to reuse the Feed
outN.output('.') // Add a separator or something.
"Hello World 2!".decodeToByteArray(UTF8).forEach { b -> feed.consume(b) }
"Hello World 2!".decodeToByteArray(UTF8).forEach(feed::consume)
} // << `Feed.use` extension function will call Feed.doFinal automatically

val encoded = sb.toString()
Expand All @@ -44,10 +44,10 @@ fun main() {
// which will then pipe each "encoded" character of output to
// the StringBuilder.
Base64.Default.newDecoderFeed(feedUTF8::consume).use { feedB64 ->
encoded.substringBefore('.').forEach { c -> feedB64.consume(c) }
encoded.substringBefore('.').forEach(feedB64::consume)
feedB64.flush() // Finalize first decoding to reuse the Feed
feedUTF8.flush() // Prepare UTF8 feed for second decoding
encoded.substringAfter('.').forEach { c -> feedB64.consume(c) }
encoded.substringAfter('.').forEach(feedB64::consume)
} // << `Feed.use` extension function will call Feed.doFinal automatically
} // << `Feed.use` extension function will call Feed.doFinal automatically

Expand Down
34 changes: 34 additions & 0 deletions library/core/api/core.api
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,42 @@ public abstract class io/matthewnelson/encoding/core/Decoder {
public synthetic fun <init> (Lio/matthewnelson/encoding/core/EncoderDecoder$Config;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
public static final fun decodeBuffered (Ljava/lang/CharSequence;ILio/matthewnelson/encoding/core/Decoder;Lkotlin/jvm/functions/Function3;)J
public static final fun decodeBuffered (Ljava/lang/CharSequence;Lio/matthewnelson/encoding/core/Decoder;Lkotlin/jvm/functions/Function3;)J
public static final fun decodeBuffered (Ljava/lang/CharSequence;Lio/matthewnelson/encoding/core/Decoder;ZIIILkotlin/jvm/functions/Function3;)J
public static final fun decodeBuffered (Ljava/lang/CharSequence;Lio/matthewnelson/encoding/core/Decoder;ZIILkotlin/jvm/functions/Function3;)J
public static final fun decodeBuffered (Ljava/lang/CharSequence;Lio/matthewnelson/encoding/core/Decoder;ZII[BLkotlin/jvm/functions/Function3;)J
public static final fun decodeBuffered (Ljava/lang/CharSequence;Lio/matthewnelson/encoding/core/Decoder;ZILkotlin/jvm/functions/Function3;)J
public static final fun decodeBuffered (Ljava/lang/CharSequence;Lio/matthewnelson/encoding/core/Decoder;ZLkotlin/jvm/functions/Function3;)J
public static final fun decodeBuffered (Ljava/lang/CharSequence;Lio/matthewnelson/encoding/core/Decoder;Z[BLkotlin/jvm/functions/Function3;)J
public static final fun decodeBuffered ([CLio/matthewnelson/encoding/core/Decoder;ZIIILkotlin/jvm/functions/Function3;)J
public static final fun decodeBuffered ([CLio/matthewnelson/encoding/core/Decoder;ZIILkotlin/jvm/functions/Function3;)J
public static final fun decodeBuffered ([CLio/matthewnelson/encoding/core/Decoder;ZII[BLkotlin/jvm/functions/Function3;)J
public static final fun decodeBuffered ([CLio/matthewnelson/encoding/core/Decoder;ZILkotlin/jvm/functions/Function3;)J
public static final fun decodeBuffered ([CLio/matthewnelson/encoding/core/Decoder;ZLkotlin/jvm/functions/Function3;)J
public static final fun decodeBuffered ([CLio/matthewnelson/encoding/core/Decoder;Z[BLkotlin/jvm/functions/Function3;)J
public static final fun decodeBufferedAsync (Ljava/lang/CharSequence;ILio/matthewnelson/encoding/core/Decoder;Lkotlin/jvm/functions/Function4;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static final fun decodeBufferedAsync (Ljava/lang/CharSequence;Lio/matthewnelson/encoding/core/Decoder;Lkotlin/jvm/functions/Function4;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static final fun decodeBufferedAsync (Ljava/lang/CharSequence;Lio/matthewnelson/encoding/core/Decoder;ZIIILkotlin/jvm/functions/Function4;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static final fun decodeBufferedAsync (Ljava/lang/CharSequence;Lio/matthewnelson/encoding/core/Decoder;ZIILkotlin/jvm/functions/Function4;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static final fun decodeBufferedAsync (Ljava/lang/CharSequence;Lio/matthewnelson/encoding/core/Decoder;ZII[BLkotlin/jvm/functions/Function4;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static final fun decodeBufferedAsync (Ljava/lang/CharSequence;Lio/matthewnelson/encoding/core/Decoder;ZILkotlin/jvm/functions/Function4;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static final fun decodeBufferedAsync (Ljava/lang/CharSequence;Lio/matthewnelson/encoding/core/Decoder;ZLkotlin/jvm/functions/Function4;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static final fun decodeBufferedAsync (Ljava/lang/CharSequence;Lio/matthewnelson/encoding/core/Decoder;Z[BLkotlin/jvm/functions/Function4;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static final fun decodeBufferedAsync ([CLio/matthewnelson/encoding/core/Decoder;ZIIILkotlin/jvm/functions/Function4;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static final fun decodeBufferedAsync ([CLio/matthewnelson/encoding/core/Decoder;ZIILkotlin/jvm/functions/Function4;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static final fun decodeBufferedAsync ([CLio/matthewnelson/encoding/core/Decoder;ZII[BLkotlin/jvm/functions/Function4;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static final fun decodeBufferedAsync ([CLio/matthewnelson/encoding/core/Decoder;ZILkotlin/jvm/functions/Function4;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static final fun decodeBufferedAsync ([CLio/matthewnelson/encoding/core/Decoder;ZLkotlin/jvm/functions/Function4;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static final fun decodeBufferedAsync ([CLio/matthewnelson/encoding/core/Decoder;Z[BLkotlin/jvm/functions/Function4;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static final fun decodeToByteArray (Ljava/lang/CharSequence;Lio/matthewnelson/encoding/core/Decoder;)[B
public static final fun decodeToByteArray (Ljava/lang/CharSequence;Lio/matthewnelson/encoding/core/Decoder;II)[B
public static final fun decodeToByteArray ([BLio/matthewnelson/encoding/core/Decoder;)[B
public static final fun decodeToByteArray ([CLio/matthewnelson/encoding/core/Decoder;)[B
public static final fun decodeToByteArray ([CLio/matthewnelson/encoding/core/Decoder;II)[B
public static final fun decodeToByteArrayOrNull (Ljava/lang/CharSequence;Lio/matthewnelson/encoding/core/Decoder;)[B
public static final fun decodeToByteArrayOrNull (Ljava/lang/CharSequence;Lio/matthewnelson/encoding/core/Decoder;II)[B
public static final fun decodeToByteArrayOrNull ([BLio/matthewnelson/encoding/core/Decoder;)[B
public static final fun decodeToByteArrayOrNull ([CLio/matthewnelson/encoding/core/Decoder;)[B
public static final fun decodeToByteArrayOrNull ([CLio/matthewnelson/encoding/core/Decoder;II)[B
public final fun getConfig ()Lio/matthewnelson/encoding/core/EncoderDecoder$Config;
public final fun newDecoderFeed (Lio/matthewnelson/encoding/core/Decoder$OutFeed;)Lio/matthewnelson/encoding/core/Decoder$Feed;
protected abstract fun newDecoderFeedProtected (Lio/matthewnelson/encoding/core/Decoder$OutFeed;)Lio/matthewnelson/encoding/core/Decoder$Feed;
Expand All @@ -31,26 +47,42 @@ public abstract class io/matthewnelson/encoding/core/Decoder {
public final class io/matthewnelson/encoding/core/Decoder$Companion {
public final fun decodeBuffered (Ljava/lang/CharSequence;ILio/matthewnelson/encoding/core/Decoder;Lkotlin/jvm/functions/Function3;)J
public final fun decodeBuffered (Ljava/lang/CharSequence;Lio/matthewnelson/encoding/core/Decoder;Lkotlin/jvm/functions/Function3;)J
public final fun decodeBuffered (Ljava/lang/CharSequence;Lio/matthewnelson/encoding/core/Decoder;ZIIILkotlin/jvm/functions/Function3;)J
public final fun decodeBuffered (Ljava/lang/CharSequence;Lio/matthewnelson/encoding/core/Decoder;ZIILkotlin/jvm/functions/Function3;)J
public final fun decodeBuffered (Ljava/lang/CharSequence;Lio/matthewnelson/encoding/core/Decoder;ZII[BLkotlin/jvm/functions/Function3;)J
public final fun decodeBuffered (Ljava/lang/CharSequence;Lio/matthewnelson/encoding/core/Decoder;ZILkotlin/jvm/functions/Function3;)J
public final fun decodeBuffered (Ljava/lang/CharSequence;Lio/matthewnelson/encoding/core/Decoder;ZLkotlin/jvm/functions/Function3;)J
public final fun decodeBuffered (Ljava/lang/CharSequence;Lio/matthewnelson/encoding/core/Decoder;Z[BLkotlin/jvm/functions/Function3;)J
public final fun decodeBuffered ([CLio/matthewnelson/encoding/core/Decoder;ZIIILkotlin/jvm/functions/Function3;)J
public final fun decodeBuffered ([CLio/matthewnelson/encoding/core/Decoder;ZIILkotlin/jvm/functions/Function3;)J
public final fun decodeBuffered ([CLio/matthewnelson/encoding/core/Decoder;ZII[BLkotlin/jvm/functions/Function3;)J
public final fun decodeBuffered ([CLio/matthewnelson/encoding/core/Decoder;ZILkotlin/jvm/functions/Function3;)J
public final fun decodeBuffered ([CLio/matthewnelson/encoding/core/Decoder;ZLkotlin/jvm/functions/Function3;)J
public final fun decodeBuffered ([CLio/matthewnelson/encoding/core/Decoder;Z[BLkotlin/jvm/functions/Function3;)J
public final fun decodeBufferedAsync (Ljava/lang/CharSequence;ILio/matthewnelson/encoding/core/Decoder;Lkotlin/jvm/functions/Function4;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public final fun decodeBufferedAsync (Ljava/lang/CharSequence;Lio/matthewnelson/encoding/core/Decoder;Lkotlin/jvm/functions/Function4;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public final fun decodeBufferedAsync (Ljava/lang/CharSequence;Lio/matthewnelson/encoding/core/Decoder;ZIIILkotlin/jvm/functions/Function4;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public final fun decodeBufferedAsync (Ljava/lang/CharSequence;Lio/matthewnelson/encoding/core/Decoder;ZIILkotlin/jvm/functions/Function4;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public final fun decodeBufferedAsync (Ljava/lang/CharSequence;Lio/matthewnelson/encoding/core/Decoder;ZII[BLkotlin/jvm/functions/Function4;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public final fun decodeBufferedAsync (Ljava/lang/CharSequence;Lio/matthewnelson/encoding/core/Decoder;ZILkotlin/jvm/functions/Function4;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public final fun decodeBufferedAsync (Ljava/lang/CharSequence;Lio/matthewnelson/encoding/core/Decoder;ZLkotlin/jvm/functions/Function4;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public final fun decodeBufferedAsync (Ljava/lang/CharSequence;Lio/matthewnelson/encoding/core/Decoder;Z[BLkotlin/jvm/functions/Function4;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public final fun decodeBufferedAsync ([CLio/matthewnelson/encoding/core/Decoder;ZIIILkotlin/jvm/functions/Function4;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public final fun decodeBufferedAsync ([CLio/matthewnelson/encoding/core/Decoder;ZIILkotlin/jvm/functions/Function4;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public final fun decodeBufferedAsync ([CLio/matthewnelson/encoding/core/Decoder;ZII[BLkotlin/jvm/functions/Function4;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public final fun decodeBufferedAsync ([CLio/matthewnelson/encoding/core/Decoder;ZILkotlin/jvm/functions/Function4;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public final fun decodeBufferedAsync ([CLio/matthewnelson/encoding/core/Decoder;ZLkotlin/jvm/functions/Function4;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public final fun decodeBufferedAsync ([CLio/matthewnelson/encoding/core/Decoder;Z[BLkotlin/jvm/functions/Function4;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public final fun decodeToByteArray (Ljava/lang/CharSequence;Lio/matthewnelson/encoding/core/Decoder;)[B
public final fun decodeToByteArray (Ljava/lang/CharSequence;Lio/matthewnelson/encoding/core/Decoder;II)[B
public final fun decodeToByteArray ([BLio/matthewnelson/encoding/core/Decoder;)[B
public final fun decodeToByteArray ([CLio/matthewnelson/encoding/core/Decoder;)[B
public final fun decodeToByteArray ([CLio/matthewnelson/encoding/core/Decoder;II)[B
public final fun decodeToByteArrayOrNull (Ljava/lang/CharSequence;Lio/matthewnelson/encoding/core/Decoder;)[B
public final fun decodeToByteArrayOrNull (Ljava/lang/CharSequence;Lio/matthewnelson/encoding/core/Decoder;II)[B
public final fun decodeToByteArrayOrNull ([BLio/matthewnelson/encoding/core/Decoder;)[B
public final fun decodeToByteArrayOrNull ([CLio/matthewnelson/encoding/core/Decoder;)[B
public final fun decodeToByteArrayOrNull ([CLio/matthewnelson/encoding/core/Decoder;II)[B
}

public abstract class io/matthewnelson/encoding/core/Decoder$Feed : io/matthewnelson/encoding/core/EncoderDecoder$Feed {
Expand Down Expand Up @@ -255,8 +287,10 @@ public final class io/matthewnelson/encoding/core/util/DecoderAction$Parser {

public final class io/matthewnelson/encoding/core/util/DecoderInput {
public fun <init> (Ljava/lang/CharSequence;)V
public fun <init> (Ljava/lang/CharSequence;II)V
public fun <init> ([B)V
public fun <init> ([C)V
public fun <init> ([CII)V
public final fun get (I)C
}

Expand Down
Loading