mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-03 00:43:46 +00:00
[BUG][kotlin-client][multiplatform] Write data to packet (#16367)
* fix: write data to packet * docs: update samples
This commit is contained in:
@@ -14,7 +14,7 @@ private fun ByteArray.clearFrom(from: Int) = (from until size).forEach { this[it
|
||||
private fun Int.toBase64(): Char = BASE64_ALPHABET[this]
|
||||
private fun Byte.fromBase64(): Byte = BASE64_INVERSE_ALPHABET[toInt() and 0xff].toByte() and BASE64_MASK
|
||||
internal fun ByteArray.encodeBase64(): String = buildPacket { writeFully(this@encodeBase64) }.encodeBase64()
|
||||
internal fun String.decodeBase64Bytes(): ByteArray = buildPacket { dropLastWhile { it == BASE64_PAD } }.decodeBase64Bytes().readBytes()
|
||||
internal fun String.decodeBase64Bytes(): ByteArray = buildPacket { writeText(dropLastWhile { it == BASE64_PAD }) }.decodeBase64Bytes().readBytes()
|
||||
|
||||
/**
|
||||
* Encode [bytes] as a HEX string with no spaces, newlines and `0x` prefixes.
|
||||
|
||||
@@ -14,7 +14,7 @@ private fun ByteArray.clearFrom(from: Int) = (from until size).forEach { this[it
|
||||
private fun Int.toBase64(): Char = BASE64_ALPHABET[this]
|
||||
private fun Byte.fromBase64(): Byte = BASE64_INVERSE_ALPHABET[toInt() and 0xff].toByte() and BASE64_MASK
|
||||
internal fun ByteArray.encodeBase64(): String = buildPacket { writeFully(this@encodeBase64) }.encodeBase64()
|
||||
internal fun String.decodeBase64Bytes(): ByteArray = buildPacket { dropLastWhile { it == BASE64_PAD } }.decodeBase64Bytes().readBytes()
|
||||
internal fun String.decodeBase64Bytes(): ByteArray = buildPacket { writeText(dropLastWhile { it == BASE64_PAD }) }.decodeBase64Bytes().readBytes()
|
||||
|
||||
/**
|
||||
* Encode [bytes] as a HEX string with no spaces, newlines and `0x` prefixes.
|
||||
|
||||
Reference in New Issue
Block a user