abstract class EnumAdapter<E : WireEnum> : ProtoAdapter<E>
An abstract ProtoAdapter that converts values of an enum to and from integers.
static val BOOL: ProtoAdapter<Boolean> |
|
static val BYTES: ProtoAdapter<ByteString> |
|
static val DOUBLE: ProtoAdapter<Double> |
|
static val FIXED32: ProtoAdapter<Int> |
|
static val FIXED64: ProtoAdapter<Long> |
|
static val FLOAT: ProtoAdapter<Float> |
|
static val INT32: ProtoAdapter<Int> |
|
static val INT64: ProtoAdapter<Long> |
|
static val SFIXED32: ProtoAdapter<Int> |
|
static val SFIXED64: ProtoAdapter<Long> |
|
static val SINT32: ProtoAdapter<Int> |
|
static val SINT64: ProtoAdapter<Long> |
|
static val STRING: ProtoAdapter<String> |
|
static val UINT32: ProtoAdapter<Int> |
|
static val UINT64: ProtoAdapter<Long>
Like INT64, but negative longs are interpreted as large positive values, and encoded that way in JSON. |
fun decode(reader: ProtoReader): E |
|
fun encode(writer: ProtoWriter, value: E): Unit |
|
fun encodedSize(value: E): Int |
fun asPacked(): ProtoAdapter<MutableList<E>>
Returns an adapter for |
|
fun asRepeated(): ProtoAdapter<MutableList<E>>
Returns an adapter for Note: Repeated items are not required to be encoded sequentially. Thus, when decoding using the returned adapter, only single-element lists will be returned and it is the caller's responsibility to merge them into the final list. |
|
fun decode(bytes: ByteArray): Efun decode(bytes: ByteString): E
Read an encoded message from fun decode(stream: InputStream): E
Read an encoded message from fun decode(source: BufferedSource): E
Read an encoded message from |
|
fun encode(sink: BufferedSink, value: E): Unitfun encode(stream: OutputStream, value: E): Unit
Encode fun encode(value: E): ByteArray
Encode |
|
open fun encodeWithTag(writer: ProtoWriter, tag: Int, value: E?): Unit
Write |
|
open fun encodedSizeWithTag(tag: Int, value: E?): Int
The size of |
|
open static fun <M : Message<Message<*, *>, Builder<*, *>>> get(message: M): ProtoAdapter<M>
Returns the adapter for the type of open static fun <M : Any> get(type: Class<M>): ProtoAdapter<M>
Returns the adapter for open static fun get(adapterString: String): ProtoAdapter<*>
Returns the adapter for a given |
|
open static fun <E : WireEnum> newEnumAdapter(type: Class<E>): RuntimeEnumAdapter<E>
Creates a new proto adapter for |
|
open static fun <K : Any, V : Any> newMapAdapter(keyAdapter: ProtoAdapter<K>, valueAdapter: ProtoAdapter<V>): ProtoAdapter<MutableMap<K, V>>
Creates a new proto adapter for a map using Note: Map entries are not required to be encoded sequentially. Thus, when decoding using the returned adapter, only single-element maps will be returned and it is the caller's responsibility to merge them into the final map. |
|
open static fun <M : Message<M, B>, B : Builder<M, B>> newMessageAdapter(type: Class<M>): ProtoAdapter<M>
Creates a new proto adapter for |
|
open fun redact(value: E): E?
Returns the redacted form of |
|
open fun toString(value: E): String
Returns a human-readable version of the given |