1 package kotlinx.serialization.cbor
2 
3 import kotlinx.serialization.*
4 
5 /**
6  * Specifies that a [ByteArray] shall be encoded/decoded as CBOR major type 2: a byte string.
7  * For types other than [ByteArray], [ByteString] will have no effect.
8  *
9  * Example usage:
10  *
11  * ```
12  * @Serializable
13  * data class Data(
14  *     @ByteString
15  *     val a: ByteArray, // CBOR major type 2: a byte string.
16  *
17  *     val b: ByteArray  // CBOR major type 4: an array of data items.
18  * )
19  * ```
20  *
21  * See [RFC 7049 2.1. Major Types](https://tools.ietf.org/html/rfc7049#section-2.1).
22  */
23 @SerialInfo
24 @Target(AnnotationTarget.PROPERTY)
25 @ExperimentalSerializationApi
26 public annotation class ByteString
27