Wire

nscn.polaris2.protoc.runtime.Wire
object Wire

The few wire-format operations that are identical in every generated message.

Deliberately small. Per-field encoding stays inlined in the generated code, where the field number and type are constants the JIT can see; what is factored out here is only the length-prefix bookkeeping, which is verbose, easy to get subtly wrong, and the same every time.

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type
Wire.type

Members list

Value members

Concrete methods

def embeddedSize(fieldNumber: Int, size: Int): Int

Size of an embedded message field, tag and length prefix included.

Size of an embedded message field, tag and length prefix included.

size is passed in rather than computed, because the caller has usually memoized it.

Attributes

def packedSize(fieldNumber: Int, dataSize: Int): Int

Size of a packed repeated field, tag and length prefix included.

Size of a packed repeated field, tag and length prefix included.

Attributes

def readEmbedded[A](input: CodedInputStream)(parse: CodedInputStream => A): A

Reads a length-delimited value, with the limit pushed while it is read.

Reads a length-delimited value, with the limit pushed while it is read.

The limit is what stops the nested parser: a generated parseFrom reads tags until the stream ends, and inside a pushLimit the end of the field looks like the end of the stream.

Attributes

def readPacked[A](input: CodedInputStream, builder: Builder[A, _])(read: CodedInputStream => A): Unit

Reads a packed repeated field into a builder.

Reads a packed repeated field into a builder.

A parser has to accept both encodings for any packable field whatever the schema says, because the schema may have changed since the message was written. Generated parsers therefore have a case for the packed tag and a case for the unpacked one.

Attributes

def writeEmbedded(output: CodedOutputStream, fieldNumber: Int, size: Int)(write: CodedOutputStream => Unit): Unit

Writes tag, length and then the message itself.

Writes tag, length and then the message itself.

Attributes

Concrete fields

final val LengthDelimited: 2

Wire type 2: a length-delimited field.

Wire type 2: a length-delimited field.

Attributes