Class ProtoReader
java.lang.Object
dev.lavalink.youtube.sabr.protobuf.ProtoReader
A minimal protocol buffers decoder that iterates over the fields of a single message.
Only the subset of functionality required to parse SABR responses is implemented.
Usage: repeatedly call readTag() until it returns -1, inspecting
getFieldNumber() and getWireType(), then pulling the value with the
relevant read* method (or skip() to ignore the field).
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic @org.jetbrains.annotations.Nullable byte[]concat(@org.jetbrains.annotations.Nullable byte[] a, @org.jetbrains.annotations.Nullable byte[] b) intintbyte[]Reads a length-delimited field as a nested message reader.intlongintreadTag()longvoidskip()Skips the value of the current field, based on its wire type.
-
Constructor Details
-
ProtoReader
public ProtoReader(byte[] data) -
ProtoReader
public ProtoReader(byte[] data, int offset, int length)
-
-
Method Details
-
readTag
public int readTag()- Returns:
- The tag of the next field, or
-1if the end of the message was reached.
-
getFieldNumber
public int getFieldNumber() -
getWireType
public int getWireType() -
readVarint
public long readVarint() -
readSInt32
public int readSInt32() -
readSInt64
public long readSInt64() -
readBytes
public byte[] readBytes() -
readString
-
readMessage
Reads a length-delimited field as a nested message reader. -
skip
public void skip()Skips the value of the current field, based on its wire type. -
concat
@Nullable public static @org.jetbrains.annotations.Nullable byte[] concat(@Nullable @org.jetbrains.annotations.Nullable byte[] a, @Nullable @org.jetbrains.annotations.Nullable byte[] b)
-