Package com.google.protobuf
Interface Writer
-
- All Known Implementing Classes:
BinaryWriter,BinaryWriter.SafeDirectWriter,BinaryWriter.SafeHeapWriter,BinaryWriter.UnsafeDirectWriter,BinaryWriter.UnsafeHeapWriter,CodedOutputStreamWriter
@ExperimentalApi @CheckReturnValue interface Writer
A writer that performs serialization of protobuf message fields.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classWriter.FieldOrderThe order in which the fields are written by aWriter.
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description Writer.FieldOrderfieldOrder()Indicates the order in which the fields are written by thisWriter.voidwriteBool(int fieldNumber, boolean value)Writes a field of typeFieldType.BOOL.voidwriteBoolList(int fieldNumber, java.util.List<java.lang.Boolean> value, boolean packed)Writes a list field of typeFieldType.BOOL.voidwriteBytes(int fieldNumber, ByteString value)Writes a field of typeFieldType.BYTES.voidwriteBytesList(int fieldNumber, java.util.List<ByteString> value)Writes a list field of typeFieldType.BYTES.voidwriteDouble(int fieldNumber, double value)Writes a field of typeFieldType.DOUBLE.voidwriteDoubleList(int fieldNumber, java.util.List<java.lang.Double> value, boolean packed)Writes a list field of typeFieldType.DOUBLE.voidwriteEndGroup(int fieldNumber)Deprecated.groups fields are deprecated.voidwriteEnum(int fieldNumber, int value)Writes a field of typeFieldType.ENUM.voidwriteEnumList(int fieldNumber, java.util.List<java.lang.Integer> value, boolean packed)Writes a list field of typeFieldType.ENUM.voidwriteFixed32(int fieldNumber, int value)Writes a field of typeFieldType.FIXED32.voidwriteFixed32List(int fieldNumber, java.util.List<java.lang.Integer> value, boolean packed)Writes a list field of typeFieldType.FIXED32.voidwriteFixed64(int fieldNumber, long value)Writes a field of typeFieldType.FIXED64.voidwriteFixed64List(int fieldNumber, java.util.List<java.lang.Long> value, boolean packed)Writes a list field of typeFieldType.FIXED64.voidwriteFloat(int fieldNumber, float value)Writes a field of typeFieldType.FLOAT.voidwriteFloatList(int fieldNumber, java.util.List<java.lang.Float> value, boolean packed)Writes a list field of typeFieldType.FLOAT.voidwriteGroup(int fieldNumber, java.lang.Object value)Deprecated.groups fields are deprecated.voidwriteGroup(int fieldNumber, java.lang.Object value, Schema schema)Deprecated.groups fields are deprecated.voidwriteGroupList(int fieldNumber, java.util.List<?> value)Deprecated.groups fields are deprecated.voidwriteGroupList(int fieldNumber, java.util.List<?> value, Schema schema)Deprecated.groups fields are deprecated.voidwriteInt32(int fieldNumber, int value)Writes a field of typeFieldType.INT32.voidwriteInt32List(int fieldNumber, java.util.List<java.lang.Integer> value, boolean packed)Writes a list field of typeFieldType.INT32.voidwriteInt64(int fieldNumber, long value)Writes a field of typeFieldType.INT64.voidwriteInt64List(int fieldNumber, java.util.List<java.lang.Long> value, boolean packed)Writes a list field of typeFieldType.INT64.<K,V>
voidwriteMap(int fieldNumber, MapEntryLite.Metadata<K,V> metadata, java.util.Map<K,V> map)Writes a map field.voidwriteMessage(int fieldNumber, java.lang.Object value)Writes a field of typeFieldType.MESSAGE.voidwriteMessage(int fieldNumber, java.lang.Object value, Schema schema)Writes a field of typeFieldType.MESSAGE.voidwriteMessageList(int fieldNumber, java.util.List<?> value)Writes a list field of typeFieldType.MESSAGE.voidwriteMessageList(int fieldNumber, java.util.List<?> value, Schema schema)Writes a list field of typeFieldType.MESSAGE.voidwriteMessageSetItem(int fieldNumber, java.lang.Object value)Writes a message field inMessageSetwire-format.voidwriteSFixed32(int fieldNumber, int value)Writes a field of typeFieldType.SFIXED32.voidwriteSFixed32List(int fieldNumber, java.util.List<java.lang.Integer> value, boolean packed)Writes a list field of typeFieldType.SFIXED32.voidwriteSFixed64(int fieldNumber, long value)Writes a field of typeFieldType.SFIXED64.voidwriteSFixed64List(int fieldNumber, java.util.List<java.lang.Long> value, boolean packed)Writes a list field of typeFieldType.SFIXED64.voidwriteSInt32(int fieldNumber, int value)Writes a field of typeFieldType.SINT32.voidwriteSInt32List(int fieldNumber, java.util.List<java.lang.Integer> value, boolean packed)Writes a list field of typeFieldType.SINT32.voidwriteSInt64(int fieldNumber, long value)Writes a field of typeFieldType.SINT64.voidwriteSInt64List(int fieldNumber, java.util.List<java.lang.Long> value, boolean packed)Writes a list field of typeFieldType.SINT64.voidwriteStartGroup(int fieldNumber)Deprecated.groups fields are deprecated.voidwriteString(int fieldNumber, java.lang.String value)Writes a field of typeFieldType.STRING.voidwriteStringList(int fieldNumber, java.util.List<java.lang.String> value)Writes a list field of typeFieldType.STRING.voidwriteUInt32(int fieldNumber, int value)Writes a field of typeFieldType.UINT32.voidwriteUInt32List(int fieldNumber, java.util.List<java.lang.Integer> value, boolean packed)Writes a list field of typeFieldType.UINT32.voidwriteUInt64(int fieldNumber, long value)Writes a field of typeFieldType.UINT64.voidwriteUInt64List(int fieldNumber, java.util.List<java.lang.Long> value, boolean packed)Writes a list field of typeFieldType.UINT64.
-
-
-
Method Detail
-
fieldOrder
Writer.FieldOrder fieldOrder()
Indicates the order in which the fields are written by thisWriter.
-
writeSFixed32
void writeSFixed32(int fieldNumber, int value) throws java.io.IOExceptionWrites a field of typeFieldType.SFIXED32.- Throws:
java.io.IOException
-
writeInt64
void writeInt64(int fieldNumber, long value) throws java.io.IOExceptionWrites a field of typeFieldType.INT64.- Throws:
java.io.IOException
-
writeSFixed64
void writeSFixed64(int fieldNumber, long value) throws java.io.IOExceptionWrites a field of typeFieldType.SFIXED64.- Throws:
java.io.IOException
-
writeFloat
void writeFloat(int fieldNumber, float value) throws java.io.IOExceptionWrites a field of typeFieldType.FLOAT.- Throws:
java.io.IOException
-
writeDouble
void writeDouble(int fieldNumber, double value) throws java.io.IOExceptionWrites a field of typeFieldType.DOUBLE.- Throws:
java.io.IOException
-
writeEnum
void writeEnum(int fieldNumber, int value) throws java.io.IOExceptionWrites a field of typeFieldType.ENUM.- Throws:
java.io.IOException
-
writeUInt64
void writeUInt64(int fieldNumber, long value) throws java.io.IOExceptionWrites a field of typeFieldType.UINT64.- Throws:
java.io.IOException
-
writeInt32
void writeInt32(int fieldNumber, int value) throws java.io.IOExceptionWrites a field of typeFieldType.INT32.- Throws:
java.io.IOException
-
writeFixed64
void writeFixed64(int fieldNumber, long value) throws java.io.IOExceptionWrites a field of typeFieldType.FIXED64.- Throws:
java.io.IOException
-
writeFixed32
void writeFixed32(int fieldNumber, int value) throws java.io.IOExceptionWrites a field of typeFieldType.FIXED32.- Throws:
java.io.IOException
-
writeBool
void writeBool(int fieldNumber, boolean value) throws java.io.IOExceptionWrites a field of typeFieldType.BOOL.- Throws:
java.io.IOException
-
writeString
void writeString(int fieldNumber, java.lang.String value) throws java.io.IOExceptionWrites a field of typeFieldType.STRING.- Throws:
java.io.IOException
-
writeBytes
void writeBytes(int fieldNumber, ByteString value) throws java.io.IOExceptionWrites a field of typeFieldType.BYTES.- Throws:
java.io.IOException
-
writeUInt32
void writeUInt32(int fieldNumber, int value) throws java.io.IOExceptionWrites a field of typeFieldType.UINT32.- Throws:
java.io.IOException
-
writeSInt32
void writeSInt32(int fieldNumber, int value) throws java.io.IOExceptionWrites a field of typeFieldType.SINT32.- Throws:
java.io.IOException
-
writeSInt64
void writeSInt64(int fieldNumber, long value) throws java.io.IOExceptionWrites a field of typeFieldType.SINT64.- Throws:
java.io.IOException
-
writeMessage
void writeMessage(int fieldNumber, java.lang.Object value) throws java.io.IOExceptionWrites a field of typeFieldType.MESSAGE.- Throws:
java.io.IOException
-
writeMessage
void writeMessage(int fieldNumber, java.lang.Object value, Schema schema) throws java.io.IOExceptionWrites a field of typeFieldType.MESSAGE.- Throws:
java.io.IOException
-
writeGroup
@Deprecated void writeGroup(int fieldNumber, java.lang.Object value) throws java.io.IOExceptionDeprecated.groups fields are deprecated.Writes a field of typeFieldType.GROUP.- Throws:
java.io.IOException
-
writeGroup
@Deprecated void writeGroup(int fieldNumber, java.lang.Object value, Schema schema) throws java.io.IOExceptionDeprecated.groups fields are deprecated.Writes a field of typeFieldType.GROUP.- Throws:
java.io.IOException
-
writeStartGroup
@Deprecated void writeStartGroup(int fieldNumber) throws java.io.IOExceptionDeprecated.groups fields are deprecated.Writes a single start group tag.- Throws:
java.io.IOException
-
writeEndGroup
@Deprecated void writeEndGroup(int fieldNumber) throws java.io.IOExceptionDeprecated.groups fields are deprecated.Writes a single end group tag.- Throws:
java.io.IOException
-
writeInt32List
void writeInt32List(int fieldNumber, java.util.List<java.lang.Integer> value, boolean packed) throws java.io.IOExceptionWrites a list field of typeFieldType.INT32.- Throws:
java.io.IOException
-
writeFixed32List
void writeFixed32List(int fieldNumber, java.util.List<java.lang.Integer> value, boolean packed) throws java.io.IOExceptionWrites a list field of typeFieldType.FIXED32.- Throws:
java.io.IOException
-
writeInt64List
void writeInt64List(int fieldNumber, java.util.List<java.lang.Long> value, boolean packed) throws java.io.IOExceptionWrites a list field of typeFieldType.INT64.- Throws:
java.io.IOException
-
writeUInt64List
void writeUInt64List(int fieldNumber, java.util.List<java.lang.Long> value, boolean packed) throws java.io.IOExceptionWrites a list field of typeFieldType.UINT64.- Throws:
java.io.IOException
-
writeFixed64List
void writeFixed64List(int fieldNumber, java.util.List<java.lang.Long> value, boolean packed) throws java.io.IOExceptionWrites a list field of typeFieldType.FIXED64.- Throws:
java.io.IOException
-
writeFloatList
void writeFloatList(int fieldNumber, java.util.List<java.lang.Float> value, boolean packed) throws java.io.IOExceptionWrites a list field of typeFieldType.FLOAT.- Throws:
java.io.IOException
-
writeDoubleList
void writeDoubleList(int fieldNumber, java.util.List<java.lang.Double> value, boolean packed) throws java.io.IOExceptionWrites a list field of typeFieldType.DOUBLE.- Throws:
java.io.IOException
-
writeEnumList
void writeEnumList(int fieldNumber, java.util.List<java.lang.Integer> value, boolean packed) throws java.io.IOExceptionWrites a list field of typeFieldType.ENUM.- Throws:
java.io.IOException
-
writeBoolList
void writeBoolList(int fieldNumber, java.util.List<java.lang.Boolean> value, boolean packed) throws java.io.IOExceptionWrites a list field of typeFieldType.BOOL.- Throws:
java.io.IOException
-
writeStringList
void writeStringList(int fieldNumber, java.util.List<java.lang.String> value) throws java.io.IOExceptionWrites a list field of typeFieldType.STRING.- Throws:
java.io.IOException
-
writeBytesList
void writeBytesList(int fieldNumber, java.util.List<ByteString> value) throws java.io.IOExceptionWrites a list field of typeFieldType.BYTES.- Throws:
java.io.IOException
-
writeUInt32List
void writeUInt32List(int fieldNumber, java.util.List<java.lang.Integer> value, boolean packed) throws java.io.IOExceptionWrites a list field of typeFieldType.UINT32.- Throws:
java.io.IOException
-
writeSFixed32List
void writeSFixed32List(int fieldNumber, java.util.List<java.lang.Integer> value, boolean packed) throws java.io.IOExceptionWrites a list field of typeFieldType.SFIXED32.- Throws:
java.io.IOException
-
writeSFixed64List
void writeSFixed64List(int fieldNumber, java.util.List<java.lang.Long> value, boolean packed) throws java.io.IOExceptionWrites a list field of typeFieldType.SFIXED64.- Throws:
java.io.IOException
-
writeSInt32List
void writeSInt32List(int fieldNumber, java.util.List<java.lang.Integer> value, boolean packed) throws java.io.IOExceptionWrites a list field of typeFieldType.SINT32.- Throws:
java.io.IOException
-
writeSInt64List
void writeSInt64List(int fieldNumber, java.util.List<java.lang.Long> value, boolean packed) throws java.io.IOExceptionWrites a list field of typeFieldType.SINT64.- Throws:
java.io.IOException
-
writeMessageList
void writeMessageList(int fieldNumber, java.util.List<?> value) throws java.io.IOExceptionWrites a list field of typeFieldType.MESSAGE.- Throws:
java.io.IOException
-
writeMessageList
void writeMessageList(int fieldNumber, java.util.List<?> value, Schema schema) throws java.io.IOExceptionWrites a list field of typeFieldType.MESSAGE.- Throws:
java.io.IOException
-
writeGroupList
@Deprecated void writeGroupList(int fieldNumber, java.util.List<?> value) throws java.io.IOExceptionDeprecated.groups fields are deprecated.Writes a list field of typeFieldType.GROUP.- Throws:
java.io.IOException
-
writeGroupList
@Deprecated void writeGroupList(int fieldNumber, java.util.List<?> value, Schema schema) throws java.io.IOExceptionDeprecated.groups fields are deprecated.Writes a list field of typeFieldType.GROUP.- Throws:
java.io.IOException
-
writeMessageSetItem
void writeMessageSetItem(int fieldNumber, java.lang.Object value) throws java.io.IOExceptionWrites a message field inMessageSetwire-format.- Parameters:
value- A message instance or an opaqueByteStringfor an unknown field.- Throws:
java.io.IOException
-
writeMap
<K,V> void writeMap(int fieldNumber, MapEntryLite.Metadata<K,V> metadata, java.util.Map<K,V> map) throws java.io.IOExceptionWrites a map field.- Throws:
java.io.IOException
-
-