ProtobufByteArrayInput

fm.serializer.protobuf.ProtobufByteArrayInput
final class ProtobufByteArrayInput(buffer: Array[Byte], options: ProtobufOptions) extends ProtobufInput

Optimized Input implementation for reading from a byte array that is much more JVM/JIT optimization friendly than reading from an InputStream.

Attributes

Graph
Supertypes
trait Input
trait RawInput
trait FieldInput
trait NestedInput
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

final def hasAnotherElement: Boolean

Is there another element to read in the collection?

Is there another element to read in the collection?

Attributes

def readLengthDelimited[T](f: Input => T): T
final def readNestedString(): String
final def readRawByteArray(): Array[Byte]
final def readRawString(): String
final def skipRawBytes(size: Int): Unit

Reads and discards size bytes.

Reads and discards size bytes.

Attributes

Throws
InvalidProtocolBufferException

The end of the stream or the current limit was reached.

Inherited methods

def allowStringMap: Boolean

Attributes

Inherited from:
ProtobufInput
final protected def checkLastTagTypeWas(expectedWireType: Int): Unit

Attributes

Inherited from:
ProtobufInput
final protected def checkLastTagWas(value: Int): Unit

Verifies that the last call to readTag() returned the given tag value. This is used to verify that a nested group ended with the correct end tag.

Verifies that the last call to readTag() returned the given tag value. This is used to verify that a nested group ended with the correct end tag.

Attributes

Throws
InvalidProtocolBufferException

value does not match the last tag.

Inherited from:
ProtobufInput
final protected def decodeZigZag32(n: Int): Int

Decode a ZigZag-encoded 32-bit value. ZigZag encodes signed integers into values that can be efficiently encoded with varint. (Otherwise, negative values must be sign-extended to 64 bits to be varint encoded, thus always taking 10 bytes on the wire.)

Decode a ZigZag-encoded 32-bit value. ZigZag encodes signed integers into values that can be efficiently encoded with varint. (Otherwise, negative values must be sign-extended to 64 bits to be varint encoded, thus always taking 10 bytes on the wire.)

Value parameters

n

An unsigned 32-bit integer, stored in a signed int because Java has no explicit unsigned support.

Attributes

Returns

A signed 32-bit integer.

Inherited from:
ProtobufInput
protected def decodeZigZag64(n: Long): Long

Decode a ZigZag-encoded 64-bit value. ZigZag encodes signed integers into values that can be efficiently encoded with varint. (Otherwise, negative values must be sign-extended to 64 bits to be varint encoded, thus always taking 10 bytes on the wire.)

Decode a ZigZag-encoded 64-bit value. ZigZag encodes signed integers into values that can be efficiently encoded with varint. (Otherwise, negative values must be sign-extended to 64 bits to be varint encoded, thus always taking 10 bytes on the wire.)

Value parameters

n

An unsigned 64-bit integer, stored in a signed int because Java has no explicit unsigned support.

Attributes

Returns

A signed 64-bit integer.

Inherited from:
ProtobufInput
final override def lastFieldName(): String

The last field name that was read (if any)

The last field name that was read (if any)

Attributes

Definition Classes
Inherited from:
ProtobufInput
final override def lastFieldNumber(): Int

The last field number that was read (if any)

The last field number that was read (if any)

Attributes

Definition Classes
Inherited from:
ProtobufInput
final protected def lastTagIsNullValue: Boolean

Was the last tag read for a null field? This is only applicable for reading fields but is safe to use in the readNestedXXX call because it will only ever be true if we are actually reading a null value field.

Was the last tag read for a null field? This is only applicable for reading fields but is safe to use in the readNestedXXX call because it will only ever be true if we are actually reading a null value field.

Attributes

Inherited from:
ProtobufInput
def nextValueIsNull: Boolean

Returns true if the next value is known to be null otherwise false if the value is not null or is unknown. This means that even if the next value ends up being null this can return false.

Returns true if the next value is known to be null otherwise false if the value is not null or is unknown. This means that even if the next value ends up being null this can return false.

Note: If the next value is null then this method should consume that input

Attributes

Inherited from:
ProtobufInput
def readFieldName(): String

If dynamic string maps are supported then this should be implemented otherwise this can just throw an exception.

If dynamic string maps are supported then this should be implemented otherwise this can just throw an exception.

null should be returns on the end of an object/message

Attributes

Inherited from:
ProtobufInput
final def readFieldNumber(nameToNumMap: FieldNameToNumberLookup): Int

Read the next field number

Read the next field number

Attributes

Inherited from:
ProtobufInput
final def readNestedBigDecimal(): BigDecimal

Attributes

Inherited from:
ProtobufInput
final def readNestedBigInteger(): BigInteger

Attributes

Inherited from:
ProtobufInput
final def readNestedBool(): Boolean

Attributes

Inherited from:
ProtobufInput
final def readNestedByteArray(): Array[Byte]

Attributes

Inherited from:
ProtobufInput

Attributes

Inherited from:
ProtobufInput
final def readNestedDouble(): Double

Attributes

Inherited from:
ProtobufInput
final def readNestedFixedInt(): Int

Attributes

Inherited from:
ProtobufInput
final def readNestedFixedLong(): Long

Attributes

Inherited from:
ProtobufInput
final def readNestedFloat(): Float

Attributes

Inherited from:
ProtobufInput
final def readNestedInt(): Int

Attributes

Inherited from:
ProtobufInput
final def readNestedLong(): Long

Attributes

Inherited from:
ProtobufInput
def readNestedObject[T](f: FieldInput => T): T

Attributes

Inherited from:
ProtobufInput
final def readNestedSignedInt(): Int

Attributes

Inherited from:
ProtobufInput
final def readNestedSignedLong(): Long

Attributes

Inherited from:
ProtobufInput
final def readNestedUnsignedInt(): Int

Attributes

Inherited from:
ProtobufInput
final def readNestedUnsignedLong(): Long

Attributes

Inherited from:
ProtobufInput
final def readRawBigDecimal(): BigDecimal

Attributes

Inherited from:
ProtobufInput
final def readRawBigInteger(): BigInteger

Attributes

Inherited from:
ProtobufInput
final def readRawBool(): Boolean

Attributes

Inherited from:
ProtobufInput
def readRawCollection[T](f: CollectionInput => T): T

Attributes

Inherited from:
ProtobufInput
final def readRawDouble(): Double

Attributes

Inherited from:
ProtobufInput
final def readRawFixedInt(): Int

Attributes

Inherited from:
ProtobufInput
final def readRawFixedLong(): Long

Attributes

Inherited from:
ProtobufInput
final def readRawFloat(): Float

Attributes

Inherited from:
ProtobufInput
final def readRawInt(): Int

Attributes

Inherited from:
ProtobufInput
final protected def readRawLittleEndian32(): Int

Read a 32-bit little-endian integer from the stream.

Read a 32-bit little-endian integer from the stream.

Attributes

Inherited from:
ProtobufInput
final protected def readRawLittleEndian64(): Long

Read a 64-bit little-endian integer from the stream.

Read a 64-bit little-endian integer from the stream.

Attributes

Inherited from:
ProtobufInput
final def readRawLong(): Long

Attributes

Inherited from:
ProtobufInput
def readRawObject[T](f: FieldInput => T): T

Attributes

Inherited from:
ProtobufInput
final def readRawSignedInt(): Int

Attributes

Inherited from:
ProtobufInput
final def readRawSignedLong(): Long

Attributes

Inherited from:
ProtobufInput
final def readRawUnsignedInt(): Int

Attributes

Inherited from:
ProtobufInput
final def readRawUnsignedLong(): Long

Attributes

Inherited from:
ProtobufInput
final protected def readRawVarint32(firstByte: Byte): Int

Read a raw Varint from the stream given the first byte. If larger than 32 bits, discard the upper bits.

Read a raw Varint from the stream given the first byte. If larger than 32 bits, discard the upper bits.

Attributes

Inherited from:
ProtobufInput
final def readRawVarint32(): Int

Read a raw Varint from the stream. If larger than 32 bits, discard the upper bits.

Read a raw Varint from the stream. If larger than 32 bits, discard the upper bits.

Attributes

Inherited from:
ProtobufInput
def reportUnsetField[T](number: Int, name: String, hasUserDefinedDefaultValue: Boolean, deserializer: Deserializer[T]): Unit

This is for reporting that fields for an object were not read and whether or not they had a user-defined default value.

This is for reporting that fields for an object were not read and whether or not they had a user-defined default value.

Value parameters

deserializer

The deserializer for the field. Note: This can be null.

hasUserDefinedDefaultValue

Whether or not there was a user defined default value (e.g. val foo: Int = 123)

name

The field name. Note: This can be null.

number

The field number

Attributes

Inherited from:
FieldInput
final def skipField(tag: Int): Boolean

Reads and discards a single field, given its tag value.

Reads and discards a single field, given its tag value.

Attributes

Returns

false if the tag is an endgroup tag, in which case nothing is skipped. Otherwise, returns true.

Inherited from:
ProtobufInput
final def skipMessage(): Unit

Reads and discards an entire message. This will read either until EOF or until an endgroup tag, whichever comes first.

Reads and discards an entire message. This will read either until EOF or until an endgroup tag, whichever comes first.

Attributes

Inherited from:
ProtobufInput
final def skipUnknownField(): Unit

Skip an unknown field value.

Skip an unknown field value.

If after calling readFieldNumber(...) we don't know how to handle the resulting field number then this method can be called to skip the value of the field after which we can call readFieldNumber(...) again.

Attributes

Inherited from:
ProtobufInput

Inherited fields

final protected var lastTag: Int

The last tag that was read by readTag()

The last tag that was read by readTag()

Attributes

Inherited from:
ProtobufInput