Package com.google.protobuf
Interface Writer
-
- All Known Implementing Classes:
BinaryWriter
,BinaryWriter.SafeDirectWriter
,BinaryWriter.SafeHeapWriter
,BinaryWriter.UnsafeDirectWriter
,BinaryWriter.UnsafeHeapWriter
,CodedOutputStreamWriter
@ExperimentalApi interface Writer
A writer that performs serialization of protobuf message fields.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
Writer.FieldOrder
The 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.FieldOrder
fieldOrder()
Indicates the order in which the fields are written by thisWriter
.void
writeBool(int fieldNumber, boolean value)
Writes a field of typeFieldType.BOOL
.void
writeBoolList(int fieldNumber, java.util.List<java.lang.Boolean> value, boolean packed)
Writes a list field of typeFieldType.BOOL
.void
writeBytes(int fieldNumber, ByteString value)
Writes a field of typeFieldType.BYTES
.void
writeBytesList(int fieldNumber, java.util.List<ByteString> value)
Writes a list field of typeFieldType.BYTES
.void
writeDouble(int fieldNumber, double value)
Writes a field of typeFieldType.DOUBLE
.void
writeDoubleList(int fieldNumber, java.util.List<java.lang.Double> value, boolean packed)
Writes a list field of typeFieldType.DOUBLE
.void
writeEndGroup(int fieldNumber)
Deprecated.groups fields are deprecated.void
writeEnum(int fieldNumber, int value)
Writes a field of typeFieldType.ENUM
.void
writeEnumList(int fieldNumber, java.util.List<java.lang.Integer> value, boolean packed)
Writes a list field of typeFieldType.ENUM
.void
writeFixed32(int fieldNumber, int value)
Writes a field of typeFieldType.FIXED32
.void
writeFixed32List(int fieldNumber, java.util.List<java.lang.Integer> value, boolean packed)
Writes a list field of typeFieldType.FIXED32
.void
writeFixed64(int fieldNumber, long value)
Writes a field of typeFieldType.FIXED64
.void
writeFixed64List(int fieldNumber, java.util.List<java.lang.Long> value, boolean packed)
Writes a list field of typeFieldType.FIXED64
.void
writeFloat(int fieldNumber, float value)
Writes a field of typeFieldType.FLOAT
.void
writeFloatList(int fieldNumber, java.util.List<java.lang.Float> value, boolean packed)
Writes a list field of typeFieldType.FLOAT
.void
writeGroup(int fieldNumber, java.lang.Object value)
Deprecated.groups fields are deprecated.void
writeGroup(int fieldNumber, java.lang.Object value, Schema schema)
Deprecated.groups fields are deprecated.void
writeGroupList(int fieldNumber, java.util.List<?> value)
Deprecated.groups fields are deprecated.void
writeGroupList(int fieldNumber, java.util.List<?> value, Schema schema)
Deprecated.groups fields are deprecated.void
writeInt32(int fieldNumber, int value)
Writes a field of typeFieldType.INT32
.void
writeInt32List(int fieldNumber, java.util.List<java.lang.Integer> value, boolean packed)
Writes a list field of typeFieldType.INT32
.void
writeInt64(int fieldNumber, long value)
Writes a field of typeFieldType.INT64
.void
writeInt64List(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.void
writeMessage(int fieldNumber, java.lang.Object value)
Writes a field of typeFieldType.MESSAGE
.void
writeMessage(int fieldNumber, java.lang.Object value, Schema schema)
Writes a field of typeFieldType.MESSAGE
.void
writeMessageList(int fieldNumber, java.util.List<?> value)
Writes a list field of typeFieldType.MESSAGE
.void
writeMessageList(int fieldNumber, java.util.List<?> value, Schema schema)
Writes a list field of typeFieldType.MESSAGE
.void
writeMessageSetItem(int fieldNumber, java.lang.Object value)
Writes a message field inMessageSet
wire-format.void
writeSFixed32(int fieldNumber, int value)
Writes a field of typeFieldType.SFIXED32
.void
writeSFixed32List(int fieldNumber, java.util.List<java.lang.Integer> value, boolean packed)
Writes a list field of typeFieldType.SFIXED32
.void
writeSFixed64(int fieldNumber, long value)
Writes a field of typeFieldType.SFIXED64
.void
writeSFixed64List(int fieldNumber, java.util.List<java.lang.Long> value, boolean packed)
Writes a list field of typeFieldType.SFIXED64
.void
writeSInt32(int fieldNumber, int value)
Writes a field of typeFieldType.SINT32
.void
writeSInt32List(int fieldNumber, java.util.List<java.lang.Integer> value, boolean packed)
Writes a list field of typeFieldType.SINT32
.void
writeSInt64(int fieldNumber, long value)
Writes a field of typeFieldType.SINT64
.void
writeSInt64List(int fieldNumber, java.util.List<java.lang.Long> value, boolean packed)
Writes a list field of typeFieldType.SINT64
.void
writeStartGroup(int fieldNumber)
Deprecated.groups fields are deprecated.void
writeString(int fieldNumber, java.lang.String value)
Writes a field of typeFieldType.STRING
.void
writeStringList(int fieldNumber, java.util.List<java.lang.String> value)
Writes a list field of typeFieldType.STRING
.void
writeUInt32(int fieldNumber, int value)
Writes a field of typeFieldType.UINT32
.void
writeUInt32List(int fieldNumber, java.util.List<java.lang.Integer> value, boolean packed)
Writes a list field of typeFieldType.UINT32
.void
writeUInt64(int fieldNumber, long value)
Writes a field of typeFieldType.UINT64
.void
writeUInt64List(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.IOException
Writes a field of typeFieldType.SFIXED32
.- Throws:
java.io.IOException
-
writeInt64
void writeInt64(int fieldNumber, long value) throws java.io.IOException
Writes a field of typeFieldType.INT64
.- Throws:
java.io.IOException
-
writeSFixed64
void writeSFixed64(int fieldNumber, long value) throws java.io.IOException
Writes a field of typeFieldType.SFIXED64
.- Throws:
java.io.IOException
-
writeFloat
void writeFloat(int fieldNumber, float value) throws java.io.IOException
Writes a field of typeFieldType.FLOAT
.- Throws:
java.io.IOException
-
writeDouble
void writeDouble(int fieldNumber, double value) throws java.io.IOException
Writes a field of typeFieldType.DOUBLE
.- Throws:
java.io.IOException
-
writeEnum
void writeEnum(int fieldNumber, int value) throws java.io.IOException
Writes a field of typeFieldType.ENUM
.- Throws:
java.io.IOException
-
writeUInt64
void writeUInt64(int fieldNumber, long value) throws java.io.IOException
Writes a field of typeFieldType.UINT64
.- Throws:
java.io.IOException
-
writeInt32
void writeInt32(int fieldNumber, int value) throws java.io.IOException
Writes a field of typeFieldType.INT32
.- Throws:
java.io.IOException
-
writeFixed64
void writeFixed64(int fieldNumber, long value) throws java.io.IOException
Writes a field of typeFieldType.FIXED64
.- Throws:
java.io.IOException
-
writeFixed32
void writeFixed32(int fieldNumber, int value) throws java.io.IOException
Writes a field of typeFieldType.FIXED32
.- Throws:
java.io.IOException
-
writeBool
void writeBool(int fieldNumber, boolean value) throws java.io.IOException
Writes a field of typeFieldType.BOOL
.- Throws:
java.io.IOException
-
writeString
void writeString(int fieldNumber, java.lang.String value) throws java.io.IOException
Writes a field of typeFieldType.STRING
.- Throws:
java.io.IOException
-
writeBytes
void writeBytes(int fieldNumber, ByteString value) throws java.io.IOException
Writes a field of typeFieldType.BYTES
.- Throws:
java.io.IOException
-
writeUInt32
void writeUInt32(int fieldNumber, int value) throws java.io.IOException
Writes a field of typeFieldType.UINT32
.- Throws:
java.io.IOException
-
writeSInt32
void writeSInt32(int fieldNumber, int value) throws java.io.IOException
Writes a field of typeFieldType.SINT32
.- Throws:
java.io.IOException
-
writeSInt64
void writeSInt64(int fieldNumber, long value) throws java.io.IOException
Writes a field of typeFieldType.SINT64
.- Throws:
java.io.IOException
-
writeMessage
void writeMessage(int fieldNumber, java.lang.Object value) throws java.io.IOException
Writes a field of typeFieldType.MESSAGE
.- Throws:
java.io.IOException
-
writeMessage
void writeMessage(int fieldNumber, java.lang.Object value, Schema schema) throws java.io.IOException
Writes a field of typeFieldType.MESSAGE
.- Throws:
java.io.IOException
-
writeGroup
@Deprecated void writeGroup(int fieldNumber, java.lang.Object value) throws java.io.IOException
Deprecated.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.IOException
Deprecated.groups fields are deprecated.Writes a field of typeFieldType.GROUP
.- Throws:
java.io.IOException
-
writeStartGroup
@Deprecated void writeStartGroup(int fieldNumber) throws java.io.IOException
Deprecated.groups fields are deprecated.Writes a single start group tag.- Throws:
java.io.IOException
-
writeEndGroup
@Deprecated void writeEndGroup(int fieldNumber) throws java.io.IOException
Deprecated.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.IOException
Writes 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.IOException
Writes 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.IOException
Writes 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.IOException
Writes 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.IOException
Writes 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.IOException
Writes 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.IOException
Writes 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.IOException
Writes 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.IOException
Writes 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.IOException
Writes a list field of typeFieldType.STRING
.- Throws:
java.io.IOException
-
writeBytesList
void writeBytesList(int fieldNumber, java.util.List<ByteString> value) throws java.io.IOException
Writes 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.IOException
Writes 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.IOException
Writes 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.IOException
Writes 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.IOException
Writes 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.IOException
Writes a list field of typeFieldType.SINT64
.- Throws:
java.io.IOException
-
writeMessageList
void writeMessageList(int fieldNumber, java.util.List<?> value) throws java.io.IOException
Writes a list field of typeFieldType.MESSAGE
.- Throws:
java.io.IOException
-
writeMessageList
void writeMessageList(int fieldNumber, java.util.List<?> value, Schema schema) throws java.io.IOException
Writes a list field of typeFieldType.MESSAGE
.- Throws:
java.io.IOException
-
writeGroupList
@Deprecated void writeGroupList(int fieldNumber, java.util.List<?> value) throws java.io.IOException
Deprecated.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.IOException
Deprecated.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.IOException
Writes a message field inMessageSet
wire-format.- Parameters:
value
- A message instance or an opaqueByteString
for 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.IOException
Writes a map field.- Throws:
java.io.IOException
-
-