Size: a a a

2021 November 26

VS

Vladimir Sitnikov in Kotlin JVM
На explicitUsabilityFromJavaApi() ?
источник

IP

Iaroslav Postovalov in Kotlin JVM
Конечно.
источник

VS

Vladimir Sitnikov in Kotlin JVM
источник
2021 November 27

с#

саша сок #KotlinGang... in Kotlin JVM
Class.Companion.instance.method(...)
источник

с#

саша сок #KotlinGang... in Kotlin JVM
вроде как
источник

VS

Vladimir Sitnikov in Kotlin JVM
Всё так. Ни разу не вызывал, но подозревал, что из Java могут быть подобные эффекты.
С горем пополам удалось затащить Kotlin в JMeter, но там код с 20 летней Java историей, и хорошо бы не светить разнообразные "Companion" в Java API.

Надо проверить-- возможно detekt содержит подобные инспекции. Но, похоже, в Kotlin хорошо бы штатным образом такое
источник
2021 November 29

D

D.Lopes in Kotlin JVM
Hello everybody. has anyone used kotlin-serializer? needed to know how I can serialize an enum class, can you help me?
источник

D

Denys in Kotlin JVM
If you are talking about kotlinx.serialization - official guide might be useful
https://github.com/Kotlin/kotlinx.serialization/blob/master/docs/builtin-classes.md#enum-classes
источник

D

D.Lopes in Kotlin JVM
I'm using Ktor, following the steps in the documentation doesn't work. I can't show the value of the enum in my GET request.
источник

D

D.Lopes in Kotlin JVM
@Serializable
enum class MassStatus { @SerialName("status") OPEN, CLOSE }
источник

D

D.Lopes in Kotlin JVM
@Serializable(with = MassStatusEnumSerializer::class)
   var status: MassStatus = MassStatus.OPEN,
источник

D

D.Lopes in Kotlin JVM
nothing worked, what could I be doing wrong?
I find this so basic and the kotlin-serializer seems to be too much work for this simple question.
источник

D

D.Lopes in Kotlin JVM
in spring boot just put: @Enumerated(EnumType.STRING) and everything ok
источник

😑

😑 in Kotlin JVM
Guys I have one ktor question.

In the first two lines of this page, it has described one way of getting response and in the other part , it has described streaming.

What is the difference between these two ways of getting multipart
(Except for the difference it has mentioned in the first line)
источник

AM

Andrew Mikhaylov in Kotlin JVM
You mean what's the difference between these two snippets?
In the top one you have access to HttpResponse object. You can read response code and headers from there, and also access the body. In the bottom one you take the body directly.
источник

😑

😑 in Kotlin JVM
No I wanna compare it with this
источник

AM

Andrew Mikhaylov in Kotlin JVM
Sorry, I have no idea how does GC relate to this.

You mean, the difference between stteaming response and reading it fully?
источник

😑

😑 in Kotlin JVM
Oh sorry I sent the wrong link.

I wanna compare it with this :
источник

😑

😑 in Kotlin JVM
источник

AM

Andrew Mikhaylov in Kotlin JVM
Yeah, I see.
When reading the response as a ByteArray, String or other similar types, you ask Ktor to read it fully and provide it to you as a whole. This is usually ok, but in case you request some huge data, Ktor would try to allocate the memory for it and might fail.
On the other hand, you can use streaming when reading the response. This way you will have access to the data byte-by-byte, chunk-by-chunk. This is fine if you just want to store the data as a local file, or you can process your data in this streaming manner — e.g. if you use streaming decompression, or SAX parser for XML, or something similar. Ktor will allocate the small buffer, put new chunk of data, you process it, then Ktor fills the next chunk, and so on. This doesn't put as much memory requirements as the other way.
источник