Does anyone use classes in ktor client like `<http...
# ktor
s
Does anyone use classes in ktor client like
<http://io.ktor.utils.io|io.ktor.utils.io>.core.Input
or
<http://io.ktor.utils.io|io.ktor.utils.io>.core.Output
? I can't find a description for them and i am affraid it is internal classes which will be deleted. My problem is that ByteReadChannel is malformed on receive but
io.ktor.utils.i.core.Input
works fine. Can i use
Input
class without fear?
Copy code
val channel: Input = httpResponse.receive() //works fine
val channel: ByteReadChannel = httpResponse.receive() // throw exception MalformedInputException: Input length = 1
a
As I see
Input
and
Output
interfaces are public. In Ktor 2.0.0 they will become abstract classes. I think you can use them without fear. @Rustam Siniukov please confirm.
👍 1
r
@e5l should know better, since he is working on IO API Also, can you please share the response that throws exception so we can check if it’s a problem on our side?
e
Yep, you can use
Input
. Could you log an issue about
ByteReadChannel
?
s
@e5l
<http://io.ktor.utils.io|io.ktor.utils.io>.charsets.MalformedInputException: Input length = 1
at <http://io.ktor.utils.io|io.ktor.utils.io>.charsets.CharsetJVMKt.throwExceptionWrapped(CharsetJVM.kt:325)
at <http://io.ktor.utils.io|io.ktor.utils.io>.charsets.CharsetJVMKt.decode(CharsetJVM.kt:199)
at <http://io.ktor.utils.io|io.ktor.utils.io>.charsets.EncodingKt.decode(Encoding.kt:103)
at <http://io.ktor.utils.io|io.ktor.utils.io>.core.StringsKt.readText(Strings.kt:255)
at <http://io.ktor.utils.io|io.ktor.utils.io>.core.StringsKt.readText$default(Strings.kt:254)
at io.ktor.client.features.json.serializer.KotlinxSerializer.read(KotlinxSerializer.kt:34)
at io.ktor.client.features.json.JsonSerializer$DefaultImpls.read(JsonSerializer.kt:31)
at io.ktor.client.features.json.serializer.KotlinxSerializer.read(KotlinxSerializer.kt:20)
at io.ktor.client.features.json.JsonFeature$Feature$install$2.invokeSuspend(JsonFeature.kt:161)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7356)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
a
@shusek please file an issue here with the details for reproducing
MalformedInputException
.
s
ok