Home
last modified time | relevance | path

Searched refs:encodeToByteArray (Results 1 – 25 of 69) sorted by relevance

123

/external/kotlinx.serialization/formats/protobuf/commonTest/src/kotlinx/serialization/protobuf/
DProtobufAbsenceTest.kt6 import kotlinx.serialization.encodeToByteArray
46 val bytes = ProtoBuf.encodeToByteArray(DefaultValue(42)) in testDefaultValue()
55 val bytes = ProtoBuf.encodeToByteArray(NullableValue(null)) in testNullableValue()
64 …assertFailsWith(SerializationException::class) { ProtoBuf.encodeToByteArray(DefaultAndNullValue(nu… in testDefaultAndNullValue()
66 val bytes = ProtoBuf.encodeToByteArray(DefaultAndNullValue(42)) in testDefaultAndNullValue()
76 val bytes = ProtoBuf.encodeToByteArray(SimpleList(emptyList())) in testSimpleList()
85 val bytes = ProtoBuf.encodeToByteArray(DefaultList(listOf(42))) in testDefaultList()
94 … assertFailsWith(SerializationException::class) { ProtoBuf.encodeToByteArray(NullableList(null)) } in testNullableList()
96 val bytes = ProtoBuf.encodeToByteArray(NullableList(emptyList())) in testNullableList()
106 …assertFailsWith(SerializationException::class) { ProtoBuf.encodeToByteArray(DefaultNullableList(nu… in testDefaultNullableList()
[all …]
DProtobufCollectionsTest.kt30 …assertFailsWith(SerializationException::class) { ProtoBuf.encodeToByteArray(NullableListElement(li… in testEncodeNullAsListElement()
35 …assertFailsWith(SerializationException::class) { ProtoBuf.encodeToByteArray(NullableMapKey(mapOf(n… in testEncodeNullAsMapKey()
40 val emptyListBytes = ProtoBuf.encodeToByteArray(ListWithNestedList(emptyList())) in testEmptyListIsNotListOfEmpty()
41 val listOfEmptyBytes = ProtoBuf.encodeToByteArray(ListWithNestedList(listOf(emptyList()))) in testEmptyListIsNotListOfEmpty()
51 val bytes = ProtoBuf.encodeToByteArray(map) in testEncodeMapWithNullableKey()
58 …assertFailsWith(SerializationException::class) { ProtoBuf.encodeToByteArray(NullableMapValue(mapOf… in testEncodeNullAsMapValue()
64 val bytes = ProtoBuf.encodeToByteArray(map) in testEncodeMapWithNullableValue()
72 val bytes = ProtoBuf.encodeToByteArray(ListWithNestedList(lists)) in testNestedList()
79 …assertFailsWith(SerializationException::class) { ProtoBuf.encodeToByteArray(ListWithNestedList(lis… in testNestedListIsNull()
85 val bytes = ProtoBuf.encodeToByteArray(ListWithNestedMap(list)) in testNestedMapInList()
[all …]
DProtobufNullAndDefaultTest.kt23 assertEquals(0, proto.encodeToByteArray(ProtoWithNullDefault()).size) in testProtobufDropDefaults()
24 … assertFailsWith<SerializationException> { proto.encodeToByteArray(ProtoWithNullDefaultAlways()) } in testProtobufDropDefaults()
25 assertEquals(0, proto.encodeToByteArray(ProtoWithNullDefaultNever()).size) in testProtobufDropDefaults()
31 assertFailsWith<SerializationException> { proto.encodeToByteArray(ProtoWithNullDefault()) } in testProtobufEncodeDefaults()
32 … assertFailsWith<SerializationException> { proto.encodeToByteArray(ProtoWithNullDefaultAlways()) } in testProtobufEncodeDefaults()
33 assertEquals(0, proto.encodeToByteArray(ProtoWithNullDefaultNever()).size) in testProtobufEncodeDefaults()
DAutoAssignIdsTest.kt20 val bytes = ProtoBuf.encodeToByteArray(WithoutIds.serializer(), w1) in saveAndRestoreWithoutIds()
28 val bytes = ProtoBuf.encodeToByteArray(WithoutIds.serializer(), w1) in incrementalIds()
DProtobufEnumTest.kt32 val bytes = ProtoBuf.encodeToByteArray(EnumHolder(SomeEnum.ALPHA)) in testUnknownValue()
50 val bytes = ProtoBuf.encodeToByteArray(Holder(AnnotatedEnum.E1)) in testUnknownValueForAnnotatedEnum()
/external/kotlinx.serialization/formats/cbor/commonTest/src/kotlinx/serialization/cbor/
DCborNumberEncodingTest.kt4 import kotlinx.serialization.encodeToByteArray
17 actual = Cbor.encodeToByteArray(number).size, in testEncodingLengthOfTinyNumbers()
30 actual = Cbor.encodeToByteArray(number).size, in testEncodingLengthOf8BitNumbers()
43 actual = Cbor.encodeToByteArray(number).size, in testEncodingLengthOf16BitNumbers()
56 actual = Cbor.encodeToByteArray(number).size, in testEncodingLengthOf32BitNumbers()
69 actual = Cbor.encodeToByteArray(number).size, in testEncodingLengthOfLargeNumbers()
79 actual = Cbor.encodeToByteArray(23).toList(), in testEncodingLargestPositiveTinyNumber()
96 actual = Cbor.encodeToByteArray(-24).toList(), in testEncodingLargestNegativeTinyNumber()
113 actual = Cbor.encodeToByteArray(255).toList(), in testEncodingLargestPositive8BitNumber()
131 actual = Cbor.encodeToByteArray(-256).toList(), in testEncodingLargestNegative8BitNumber()
[all …]
/external/okio/okio/src/zlibTest/kotlin/okio/internal/
DCRC32Test.kt24 crc32.update("hello world!".encodeToByteArray()) in happyPath()
30 crc32.update("hello ".encodeToByteArray()) in multipleUpdates()
31 crc32.update("world!".encodeToByteArray()) in multipleUpdates()
37 crc32.update("unused".encodeToByteArray()) in resetClearsState()
40 crc32.update("hello ".encodeToByteArray()) in resetClearsState()
41 crc32.update("world!".encodeToByteArray()) in resetClearsState()
47 crc32.update("well hello there".encodeToByteArray(), 5, 6) in offsetAndByteCountAreHonored()
48 crc32.update("city! world! universe!".encodeToByteArray(), 6, 6) in offsetAndByteCountAreHonored()
/external/kotlinx.serialization/benchmark/src/jmh/kotlin/kotlinx/benchmarks/protobuf/
DProtoBaseline.kt26 private val holderBytes = ProtoBuf.encodeToByteArray(Holder.serializer(), holder)
29 …private val holderHolderExplicitBytes = ProtoBuf.encodeToByteArray(HolderExplicit.serializer(), ho…
32 fun toBytes() = ProtoBuf.encodeToByteArray(Holder.serializer(), holder)
38 fun toBytesExplicit() = ProtoBuf.encodeToByteArray(HolderExplicit.serializer(), holderExplicit)
DProtoListBenchmark.kt8 import kotlinx.serialization.protobuf.ProtoBuf.Default.encodeToByteArray
28 private val bytes = ProtoBuf.encodeToByteArray(value)
31 fun toBytes() = ProtoBuf.encodeToByteArray(HolderList.serializer(), value)
DProtoListLikeBenchmark.kt27 private val bytes = ProtoBuf.encodeToByteArray(value)
30 fun toBytes() = ProtoBuf.encodeToByteArray(HolderList.serializer(), value)
/external/kotlinx.serialization/core/commonMain/src/kotlinx/serialization/
DSerialFormat.kt66 public fun <T> encodeToByteArray(serializer: SerializationStrategy<T>, value: T): ByteArray in encodeToByteArray() method
138 InternalHexConverter.printHexBinary(encodeToByteArray(serializer, value), lowerCase = true)
185 public inline fun <reified T> BinaryFormat.encodeToByteArray(value: T): ByteArray = method
186 encodeToByteArray(serializersModule.serializer(), value)
/external/kotlinx.serialization/formats/protobuf/jvmTest/src/kotlinx/serialization/protobuf/conformance/
DProto3MessageTest.kt24 ProtoBuf.encodeToByteArray(this) in toProto()
35 ProtoBuf.encodeToByteArray(this) in toProto()
56 val bytes = ProtoBuf.encodeToByteArray(message) in default()
DProto3PackedTest.kt41 val bytes = ProtoBuf.encodeToByteArray(message) in default()
67 val bytes = ProtoBuf.encodeToByteArray(message) in signedAndFixed()
90 val bytes = ProtoBuf.encodeToByteArray(message) in unsigned()
DProto3RepeatedTest.kt63 val bytes = ProtoBuf.encodeToByteArray(message) in default()
98 val bytes = ProtoBuf.encodeToByteArray(message) in signedAndFixed()
124 val bytes = ProtoBuf.encodeToByteArray(message) in unsigned()
/external/cronet/stable/third_party/protobuf/java/core/src/test/java/com/google/protobuf/
DUtf8Test.java137 byte[] output = encodeToByteArray(message, expected.length, safeProcessor); in assertEncoding()
141 output = encodeToByteArray(message, expected.length, unsafeProcessor); in assertEncoding()
163 encodeToByteArray(message, length, safeProcessor); in assertEncoding_insufficientSpace()
173 encodeToByteArray(message, length, unsafeProcessor); in assertEncoding_insufficientSpace()
218 private static byte[] encodeToByteArray(String message, int length, Utf8.Processor processor) { in encodeToByteArray() method in Utf8Test
/external/protobuf/java/core/src/test/java/com/google/protobuf/
DUtf8Test.java137 byte[] output = encodeToByteArray(message, expected.length, safeProcessor); in assertEncoding()
141 output = encodeToByteArray(message, expected.length, unsafeProcessor); in assertEncoding()
163 encodeToByteArray(message, length, safeProcessor); in assertEncoding_insufficientSpace()
173 encodeToByteArray(message, length, unsafeProcessor); in assertEncoding_insufficientSpace()
218 private static byte[] encodeToByteArray(String message, int length, Utf8.Processor processor) { in encodeToByteArray() method in Utf8Test
/external/cronet/tot/third_party/protobuf/java/core/src/test/java/com/google/protobuf/
DUtf8Test.java137 byte[] output = encodeToByteArray(message, expected.length, safeProcessor); in assertEncoding()
141 output = encodeToByteArray(message, expected.length, unsafeProcessor); in assertEncoding()
163 encodeToByteArray(message, length, safeProcessor); in assertEncoding_insufficientSpace()
173 encodeToByteArray(message, length, unsafeProcessor); in assertEncoding_insufficientSpace()
218 private static byte[] encodeToByteArray(String message, int length, Utf8.Processor processor) { in encodeToByteArray() method in Utf8Test
/external/flatbuffers/kotlin/flatbuffers-kotlin/src/commonTest/kotlin/com/google/flatbuffers/kotlin/
DBuffersTest.kt12 val bytes = text.encodeToByteArray() in readBufferStringTest()
35 val bytes = text.encodeToByteArray() in readWriteBufferPrimitivesTest()
49 val jap = " are really すごい!".encodeToByteArray() in readWriteBufferPrimitivesTest()
DJSONTest.kt29 val data = dataStr.encodeToByteArray() in parse2Test()
54 val data = dataStr.encodeToByteArray() in parseSample()
346 JSONParser().parse(ArrayReadBuffer(data.encodeToByteArray())) in testParseMustFail()
424 JSONParser().parse(ArrayReadBuffer(data.encodeToByteArray())) in testParseMustPass()
/external/flatbuffers/kotlin/flatbuffers-kotlin/src/commonMain/kotlin/com/google/flatbuffers/kotlin/
Djson.kt123 public fun parse(data: String): Reference = parse(ArrayReadBuffer(data.encodeToByteArray())) in parse()
690 this['\n'.code] = "\\n".encodeToByteArray() in <lambda>()
691 this['\t'.code] = "\\t".encodeToByteArray() in <lambda>()
692 this['\r'.code] = "\\r".encodeToByteArray() in <lambda>()
693 this['\b'.code] = "\\b".encodeToByteArray() in <lambda>()
694 this[0x0c] = "\\f".encodeToByteArray() in <lambda>()
695 this['"'.code] = "\\\"".encodeToByteArray() in <lambda>()
696 this['\\'.code] = "\\\\".encodeToByteArray() in <lambda>()
698 this[i] = "\\u${i.toPaddedHex()}".encodeToByteArray() in <lambda>()
/external/okio/okio/src/commonTest/kotlin/okio/
DByteStringTest.kt500 val byteArray = "WwwwXxxxYyyyZzzz".encodeToByteArray() in copyInto()
507 val byteArray = "WwwwXxxxYyyyZzzz".encodeToByteArray() in copyIntoFullRange()
514 val byteArray = "WwwwXxxxYyyyZzzz".encodeToByteArray() in copyIntoWithTargetOffset()
521 val byteArray = "WwwwXxxxYyyyZzzz".encodeToByteArray() in copyIntoWithSourceOffset()
528 val byteArray = "WwwwXxxxYyyyZzzz".encodeToByteArray() in copyIntoWithAllParameters()
535 val byteArray = "WwwwXxxxYyyyZzzz".encodeToByteArray() in copyIntoBoundsChecks()
558 val byteArray = "WwwwXxxxYyyyZzzz".encodeToByteArray() in copyEmptyAtBounds()
569 val bytes = "Hello, World!".encodeToByteArray() in ofCopy()
578 val bytes = "Hello, World!".encodeToByteArray() in ofCopyRange()
/external/kotlinx.serialization/benchmark/src/jmh/kotlin/kotlinx/benchmarks/cbor/
DCborBaseLine.kt54 val baseBytes = cbor.encodeToByteArray(KTestOuterMessage.serializer(), baseMessage)
57 fun toBytes() = cbor.encodeToByteArray(KTestOuterMessage.serializer(), baseMessage)
/external/kotlinx.serialization/formats/cbor/commonMain/src/kotlinx/serialization/cbor/internal/
DEncoder.kt258 this.encodeByteArray(value.encodeToByteArray(), HEADER_STRING) in encodeString()
302 in (UByte.MAX_VALUE.toUInt() + 1u)..UShort.MAX_VALUE.toUInt() -> encodeToByteArray(value, 2, 25) in composePositive()
303 in (UShort.MAX_VALUE.toUInt() + 1u)..UInt.MAX_VALUE -> encodeToByteArray(value, 4, 26) in composePositive()
304 else -> encodeToByteArray(value, 8, 27) in composePositive()
316 private fun encodeToByteArray(value: ULong, bytes: Int, tag: Byte): ByteArray { in encodeToByteArray() method
/external/flatbuffers/kotlin/benchmark/src/jvmMain/kotlin/com/google/flatbuffers/kotlin/benchmark/
DUTF8Benchmark.kt43 private var sampleSmallUtf8Decoded = sampleSmallUtf8.map { it.encodeToByteArray() }.toList() in <lambda>()
45 private var sampleSmallAsciiDecoded = sampleSmallAscii.map { it.encodeToByteArray() }.toList() in <lambda>()
54 blackhole.consume(i.encodeToByteArray()) in encodeUtf8KotlinStandard()
101 blackhole.consume(i.encodeToByteArray()) in encodeAsciiKotlinStandard()
/external/kotlinx.serialization/formats/protobuf/jvmTest/src/kotlinx/serialization/protobuf/
DProtoBufOptionalTest.kt52 val parsed = TestData.MessageWithOptionals.parseFrom(protoBuf.encodeToByteArray(data)) in <lambda>()
69 val parsed = TestData.MessageWithOptionals.parseFrom(protoBuf.encodeToByteArray(data)) in <lambda>()

123