public abstract class JsonSource extends Object implements Closeable
https://developers.google.com/protocol-buffers/docs/proto3#json
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
ignoreUnknownFields |
| Constructor and Description |
|---|
JsonSource() |
| Modifier and Type | Method and Description |
|---|---|
abstract void |
beginArray() |
abstract boolean |
beginObject()
Consumes the begin object token.
|
protected static void |
decodeBase64(RepeatedByte input,
RepeatedByte output) |
protected static void |
decodeBase64(String input,
RepeatedByte output) |
abstract void |
endArray() |
abstract void |
endObject() |
abstract boolean |
isAtEnd()
Returns true if the source has reached the end of the input,
or the end of an object or array.
|
boolean |
isAtField(FieldName fieldName) |
protected abstract boolean |
isAtNull() |
static JsonSource |
newInstance(byte[] bytes) |
static JsonSource |
newInstance(byte[] bytes,
int offset,
int length) |
static JsonSource |
newInstance(InputStream inputStream) |
static JsonSource |
newInstance(RepeatedByte bytes) |
static JsonSource |
newInstance(String string) |
<ProtoMsg extends ProtoMessage<ProtoMsg>> |
parseMessage(MessageFactory<ProtoMsg> factory)
Parses a root-level object of the given message type and checks for required field initialization
|
<ProtoMsg extends ProtoMessage<ProtoMsg>> |
parseRepeatedMessage(MessageFactory<ProtoMsg> factory)
Parses a root-level array of the given message type and checks for required field initialization
|
abstract boolean |
readBool()
Read a
bool field value from the source. |
abstract void |
readBytes(RepeatedByte store)
Read a
bytes field value from the source. |
abstract ProtoSource |
readBytesAsSource() |
abstract double |
readDouble()
Read a
double field value from the source. |
abstract <T extends ProtoEnum<?>> |
readEnum(ProtoEnum.EnumConverter<T> converter)
Read a
enum field value from the source. |
int |
readFieldHash() |
int |
readFieldHashOrZero() |
protected abstract CharSequence |
readFieldName() |
int |
readFixed32()
Read a
fixed32 field value from the source. |
long |
readFixed64()
Read a
fixed64 field value from the source. |
float |
readFloat()
Read a
float field value from the source. |
<ProtoMsg extends ProtoMessage<ProtoMsg>> |
readGroup(ProtoMsg msg)
Read a
group field value from the source. |
abstract int |
readInt32()
Read an
int32 field value from the source. |
abstract long |
readInt64()
Read an
int64 field value from the source. |
<ProtoMsg extends ProtoMessage<ProtoMsg>> |
readMessage(ProtoMsg msg)
Reads a message value from the source and merges the contents into the provided message
|
void |
readRepeatedBool(RepeatedBoolean value) |
void |
readRepeatedBytes(RepeatedBytes value) |
void |
readRepeatedDouble(RepeatedDouble value) |
<E extends ProtoEnum<?>> |
readRepeatedEnum(RepeatedEnum<E> value,
ProtoEnum.EnumConverter<E> converter) |
void |
readRepeatedFixed32(RepeatedInt value) |
void |
readRepeatedFixed64(RepeatedLong value) |
void |
readRepeatedFloat(RepeatedFloat value) |
void |
readRepeatedGroup(RepeatedMessage<?> value) |
void |
readRepeatedInt32(RepeatedInt value) |
void |
readRepeatedInt64(RepeatedLong value) |
<ProtoMsg extends ProtoMessage<ProtoMsg>> |
readRepeatedMessage(RepeatedMessage<ProtoMsg> value) |
void |
readRepeatedSFixed32(RepeatedInt value) |
void |
readRepeatedSFixed64(RepeatedLong value) |
void |
readRepeatedSInt32(RepeatedInt value) |
void |
readRepeatedSInt64(RepeatedLong value) |
void |
readRepeatedString(RepeatedString value) |
void |
readRepeatedUInt32(RepeatedInt value) |
void |
readRepeatedUInt64(RepeatedLong value) |
int |
readSFixed32()
Read an
sfixed32 field value from the source. |
long |
readSFixed64()
Read an
sfixed64 field value from the source. |
int |
readSInt32()
Read an
sint32 field value from the source. |
long |
readSInt64()
Read an
sint64 field value from the source. |
abstract void |
readString(Utf8String store)
Read a
string field value from the source. |
int |
readUInt32()
Read a
uint32 field value from the source. |
long |
readUInt64()
Read a
uint64 field value from the source. |
JsonSource |
setIgnoreUnknownFields(boolean ignoreUnknownFields)
Allows to serialize enums as human readable strings or
as JSON numbers.
|
void |
skipUnknownEnumValue() |
void |
skipUnknownField() |
protected abstract void |
skipValue()
Skips the current value
|
boolean |
trySkipNullValue() |
public static JsonSource newInstance(byte[] bytes)
public static JsonSource newInstance(byte[] bytes, int offset, int length)
public static JsonSource newInstance(RepeatedByte bytes)
public static JsonSource newInstance(InputStream inputStream)
public static JsonSource newInstance(String string)
public <ProtoMsg extends ProtoMessage<ProtoMsg>> ProtoMsg parseMessage(MessageFactory<ProtoMsg> factory) throws IOException
IOExceptionpublic <ProtoMsg extends ProtoMessage<ProtoMsg>> RepeatedMessage<ProtoMsg> parseRepeatedMessage(MessageFactory<ProtoMsg> factory) throws IOException
IOExceptionpublic JsonSource setIgnoreUnknownFields(boolean ignoreUnknownFields)
Unknown values will still be serialized as numbers.
ignoreUnknownFields - true if values should use stringspublic void skipUnknownField()
throws IOException
IOExceptionpublic void skipUnknownEnumValue()
throws IOException
IOExceptionpublic abstract double readDouble()
throws IOException
double field value from the source.
JSON value will be a number or one of the special string values "NaN", "Infinity", and "-Infinity". Either numbers or strings are accepted. Exponent notation is also accepted. -0 is considered equivalent to 0.
IOExceptionpublic abstract int readInt32()
throws IOException
int32 field value from the source.
Either numbers or strings are accepted.IOExceptionpublic abstract long readInt64()
throws IOException
int64 field value from the source.
Either numbers or strings are accepted.IOExceptionpublic abstract boolean readBool()
throws IOException
bool field value from the source.
Parsers accept true or false.IOExceptionpublic abstract <T extends ProtoEnum<?>> T readEnum(ProtoEnum.EnumConverter<T> converter) throws IOException
enum field value from the source.
The name of the enum value as specified in proto is used. Parsers accept both enum names and integer values.
IOExceptionpublic abstract void readString(Utf8String store) throws IOException
string field value from the source.IOExceptionpublic abstract void readBytes(RepeatedByte store) throws IOException
bytes field value from the source.
Either standard or URL-safe base64 encoding with/without paddings are accepted.
IOExceptionpublic abstract ProtoSource readBytesAsSource() throws IOException
IOExceptionpublic <ProtoMsg extends ProtoMessage<ProtoMsg>> ProtoMsg readMessage(ProtoMsg msg) throws IOException
IOExceptionprotected abstract void skipValue()
throws IOException
IOExceptionpublic float readFloat()
throws IOException
float field value from the source.IOExceptionpublic long readUInt64()
throws IOException
uint64 field value from the source.IOExceptionpublic long readFixed64()
throws IOException
fixed64 field value from the source.IOExceptionpublic int readFixed32()
throws IOException
fixed32 field value from the source.IOExceptionpublic <ProtoMsg extends ProtoMessage<ProtoMsg>> ProtoMsg readGroup(ProtoMsg msg) throws IOException
group field value from the source.IOExceptionpublic int readUInt32()
throws IOException
uint32 field value from the source.IOExceptionpublic int readSFixed32()
throws IOException
sfixed32 field value from the source.IOExceptionpublic long readSFixed64()
throws IOException
sfixed64 field value from the source.IOExceptionpublic int readSInt32()
throws IOException
sint32 field value from the source.IOExceptionpublic long readSInt64()
throws IOException
sint64 field value from the source.IOExceptionpublic void readRepeatedFixed64(RepeatedLong value) throws IOException
IOExceptionpublic void readRepeatedSFixed64(RepeatedLong value) throws IOException
IOExceptionpublic void readRepeatedUInt64(RepeatedLong value) throws IOException
IOExceptionpublic void readRepeatedSInt64(RepeatedLong value) throws IOException
IOExceptionpublic void readRepeatedFixed32(RepeatedInt value) throws IOException
IOExceptionpublic void readRepeatedSFixed32(RepeatedInt value) throws IOException
IOExceptionpublic void readRepeatedUInt32(RepeatedInt value) throws IOException
IOExceptionpublic void readRepeatedSInt32(RepeatedInt value) throws IOException
IOExceptionpublic void readRepeatedGroup(RepeatedMessage<?> value) throws IOException
IOExceptionpublic void readRepeatedDouble(RepeatedDouble value) throws IOException
IOExceptionpublic void readRepeatedInt64(RepeatedLong value) throws IOException
IOExceptionpublic void readRepeatedFloat(RepeatedFloat value) throws IOException
IOExceptionpublic void readRepeatedInt32(RepeatedInt value) throws IOException
IOExceptionpublic <ProtoMsg extends ProtoMessage<ProtoMsg>> RepeatedMessage<ProtoMsg> readRepeatedMessage(RepeatedMessage<ProtoMsg> value) throws IOException
IOExceptionpublic void readRepeatedString(RepeatedString value) throws IOException
IOExceptionpublic <E extends ProtoEnum<?>> void readRepeatedEnum(RepeatedEnum<E> value, ProtoEnum.EnumConverter<E> converter) throws IOException
IOExceptionpublic void readRepeatedBool(RepeatedBoolean value) throws IOException
IOExceptionpublic void readRepeatedBytes(RepeatedBytes value) throws IOException
IOExceptionpublic abstract void beginArray()
throws IOException
IOExceptionpublic abstract void endArray()
throws IOException
IOExceptionpublic abstract boolean beginObject()
throws IOException
IOExceptionpublic abstract void endObject()
throws IOException
IOExceptionpublic abstract boolean isAtEnd()
throws IOException
IOExceptionpublic boolean trySkipNullValue()
throws IOException
IOExceptionprotected abstract boolean isAtNull()
throws IOException
IOExceptionpublic final int readFieldHash()
throws IOException
IOExceptionpublic final int readFieldHashOrZero()
throws IOException
IOExceptionpublic boolean isAtField(FieldName fieldName)
fieldName - expected fieldprotected abstract CharSequence readFieldName() throws IOException
IOExceptionprotected static void decodeBase64(String input, RepeatedByte output)
protected static void decodeBase64(RepeatedByte input, RepeatedByte output)
Copyright © 2019–2024 HEBI Robotics. All rights reserved.