Package-level declarations

Types

Link copied to clipboard
abstract class AndroidMessage<M : Message<M, B>, B : Message.Builder<M, B>> : Message<M, B> , Parcelable

An Android-specific Message which adds support for Parcelable.

Link copied to clipboard
class AnyMessage(val typeUrl: String, val value: ByteString = ByteString.EMPTY) : Message<AnyMessage, Nothing>

Wire implementation of the google.protobuf.Any type. The Any type wraps an arbitrary protobuf message. Field of Any generated by Wire will be typed AnyMessage. typeUrl is used to identify the type of the message, defined as 'type.googleapis.com/full.type.name'. value is the serialized representation of the wrapped message. The pack and unpack methods are available to wrap and unwrap an Any message.

Link copied to clipboard
expect class Duration

A measurement of time. Durations may be positive, zero, or negative.

actual class Duration
actual typealias Duration = java.time.Duration
actual class Duration
Link copied to clipboard
expect abstract class EnumAdapter<E : WireEnum> : ProtoAdapter<E>

An abstract ProtoAdapter that converts values of an enum to and from integers.

actual abstract class EnumAdapter<E : WireEnum> : ProtoAdapter<E>

An abstract ProtoAdapter that converts values of an enum to and from integers.

actual abstract class EnumAdapter<E : WireEnum> : ProtoAdapter<E>

An abstract ProtoAdapter that converts values of an enum to and from integers.

actual abstract class EnumAdapter<E : WireEnum> : ProtoAdapter<E>

An abstract ProtoAdapter that converts values of an enum to and from integers.

Link copied to clipboard
Link copied to clipboard
expect class Instant

This represents a timestamp, though we use the name 'instant' in the runtime because that's what the JVM libraries use, and 'Timestamp' means something else on that platform.

actual class Instant
actual typealias Instant = java.time.Instant
actual class Instant
Link copied to clipboard
expect abstract class Message<M : Message<M, B>, B : Message.Builder<M, B>>

A protocol buffer message.

actual abstract class Message<M : Message<M, B>, B : Message.Builder<M, B>>

A protocol buffer message.

actual abstract class Message<M : Message<M, B>, B : Message.Builder<M, B>> : Serializable

A protocol buffer message.

actual abstract class Message<M : Message<M, B>, B : Message.Builder<M, B>>

A protocol buffer message.

Link copied to clipboard
expect interface MessageSink<in T : Any>

A writable stream of messages.

actual interface MessageSink<in T : Any>
actual interface MessageSink<in T : Any> : Closeable
actual interface MessageSink<in T : Any>
Link copied to clipboard
expect interface MessageSource<out T : Any>

A readable stream of messages.

actual interface MessageSource<out T : Any>
actual interface MessageSource<out T : Any> : Closeable
actual interface MessageSource<out T : Any>
Link copied to clipboard
data class OneOf<out K : OneOf.Key<T>, T>(val key: K, val value: T)

A oneof's value and the key that identifies which field holds it.

Link copied to clipboard
expect abstract class ProtoAdapter<E>(fieldEncoding: FieldEncoding, type: KClass<*>?, typeUrl: String?, syntax: Syntax, identity: E? = null, sourceFile: String? = null)
actual abstract class ProtoAdapter<E>(fieldEncoding: FieldEncoding, val type: KClass<*>?, val typeUrl: String?, val syntax: Syntax, val identity: E?, val sourceFile: String?)
actual abstract class ProtoAdapter<E>(fieldEncoding: FieldEncoding, val type: KClass<*>?, val typeUrl: String?, val syntax: Syntax, val identity: E?, val sourceFile: String?)
actual abstract class ProtoAdapter<E>(fieldEncoding: FieldEncoding, val type: KClass<*>?, val typeUrl: String?, val syntax: Syntax, val identity: E?, val sourceFile: String?)
Link copied to clipboard
class ProtoReader(source: BufferedSource)

Reads and decodes protocol message fields.

Link copied to clipboard
class ProtoWriter(sink: BufferedSink)

Utilities for encoding and writing protocol message fields.

Link copied to clipboard

Encodes protocol buffer message fields from back-to-front for efficiency. Callers should write data in the opposite order that the data will be read.

Link copied to clipboard

Converts values of an enum to and from integers using reflection.

Link copied to clipboard
interface Service
Link copied to clipboard
enum Syntax : Enum<Syntax>

Syntax version.

Link copied to clipboard
interface WireEnum

Interface for generated Enum values to help serialization and deserialization.

Link copied to clipboard
@Target(allowedTargets = [AnnotationTarget.FIELD])
annotation class WireEnumConstant(val declaredName: String = "")

Annotates generated WireEnum fields with metadata for serialization and deserialization.

Link copied to clipboard
@Target(allowedTargets = [AnnotationTarget.FIELD])
annotation class WireField(val tag: Int, val keyAdapter: String = "", val adapter: String, val label: WireField.Label = Label.OPTIONAL, val redacted: Boolean = false, val declaredName: String = "", val jsonName: String = "", val oneofName: String = "", val schemaIndex: Int = -1)

Annotates generated Message fields with metadata for serialization and deserialization.

Link copied to clipboard
@Target(allowedTargets = [AnnotationTarget.FUNCTION])
annotation class WireRpc(val path: String, val requestAdapter: String, val responseAdapter: String, val sourceFile: String = "")

For gRPC actions the path is formatted as /<service name>/<method name>. The path of the proto service below is /squareup.helloworld.Greeter/SayHello.

Functions

Link copied to clipboard
fun <E> ProtoAdapter<E>.decode(data: <Error class: unknown class>): E

Read an encoded message from data.

Link copied to clipboard
expect fun durationOfSeconds(seconds: Long, nano: Long): Duration
actual fun durationOfSeconds(seconds: Long, nano: Long): Duration
actual inline fun durationOfSeconds(seconds: Long, nano: Long): Duration
actual fun durationOfSeconds(seconds: Long, nano: Long): Duration
Link copied to clipboard
fun <T> get(value: T?, defaultValue: T): T

Returns value if it is not null; defaultValue otherwise. This is used to conveniently return a default value when a value is null. For example,

Link copied to clipboard
expect fun ofEpochSecond(epochSecond: Long, nano: Long): Instant
actual fun ofEpochSecond(epochSecond: Long, nano: Long): Instant
actual inline fun ofEpochSecond(epochSecond: Long, nano: Long): Instant
actual fun ofEpochSecond(epochSecond: Long, nano: Long): Instant