Skip to content

Commit

Permalink
Remove unneeded and incorrect comments and commented-out code
Browse files Browse the repository at this point in the history
Wrapping something as a Vert.x `Buffer` by implementing the `Buffer` interface is not viable because `BufferImpl` contains casts from a `Buffer` to a `BufferImpl`.
  • Loading branch information
ShreckYe committed Oct 31, 2024
1 parent 40ee72b commit 148014e
Showing 1 changed file with 0 additions and 14 deletions.
14 changes: 0 additions & 14 deletions frameworks/Kotlin/vertx-web-kotlinx/src/main/kotlin/Okio.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,10 @@ import okio.Timeout
import io.vertx.core.buffer.Buffer as VertxBuffer
import okio.Buffer as OkioBuffer

// too complicated to implement
// Also there are casts from `Buffer` to `BufferImpl` in Vert.x
/*
@JvmInline
value class OkioBufferVertxBuffer(val okioBuffer: OkioBuffer) : VertxBuffer {
}
fun OkioBuffer.toVertxBuffer(): VertxBuffer =
OkioBufferVertxBuffer(this)
*/


@JvmInline
value class VertxBufferWriteStreamSink(val writeStream: WriteStream<VertxBuffer>) : Sink {
override fun write(source: OkioBuffer, byteCount: Long) {
runBlocking {
// `source` is temporarily converted to a byte array because wrapping it as a Vert.x `Buffer` is too complicated to implement.
writeStream.write(VertxBuffer.buffer(source.readByteArray(byteCount))).coAwait()
}
}
Expand All @@ -47,7 +34,6 @@ fun WriteStream<VertxBuffer>.toSink(): Sink =
@JvmInline
value class VertxBufferSink(val vertxBuffer: VertxBuffer) : Sink {
override fun write(source: Buffer, byteCount: Long) {
// same problem as above
vertxBuffer.appendBytes(source.readByteArray(byteCount))
}

Expand Down

0 comments on commit 148014e

Please sign in to comment.