Package com.google.protobuf
Class BinaryWriter
- java.lang.Object
-
- com.google.protobuf.ByteOutput
-
- com.google.protobuf.BinaryWriter
-
- All Implemented Interfaces:
Writer
- Direct Known Subclasses:
BinaryWriter.SafeDirectWriter,BinaryWriter.SafeHeapWriter,BinaryWriter.UnsafeDirectWriter,BinaryWriter.UnsafeHeapWriter
@CheckReturnValue @ExperimentalApi abstract class BinaryWriter extends ByteOutput implements Writer
A protobuf writer that serializes messages in their binary form. Messages are serialized in reverse in order to avoid calculating the serialized size of each nested message. Since the message size is not known in advance, the writer employs a strategy of chunking and buffer chaining. Buffers are allocated as-needed by a providedBufferAllocator. Once writing is finished, the application can access the buffers in forward-writing order by callingcomplete().Once
complete()has been called, the writer can not be reused for additional writes. ThegetTotalBytesWritten()will continue to reflect the total of the write and will not be reset.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classBinaryWriter.SafeDirectWriterWriter that uses safe operations on a targetByteBuffer.private static classBinaryWriter.SafeHeapWriterWriter that uses safe operations on target array.private static classBinaryWriter.UnsafeDirectWriterWriter that uses unsafe operations on a targetByteBuffer.private static classBinaryWriter.UnsafeHeapWriterWriter that uses unsafe operations on a target array.-
Nested classes/interfaces inherited from interface com.google.protobuf.Writer
Writer.FieldOrder
-
-
Field Summary
Fields Modifier and Type Field Description private BufferAllocatoralloc(package private) java.util.ArrayDeque<AllocatedBuffer>buffersprivate intchunkSizestatic intDEFAULT_CHUNK_SIZEprivate static intMAP_KEY_NUMBERprivate static intMAP_VALUE_NUMBER(package private) inttotalDoneBytes
-
Constructor Summary
Constructors Modifier Constructor Description privateBinaryWriter(BufferAllocator alloc, int chunkSize)Only allow subclassing for inner classes.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description java.util.Queue<AllocatedBuffer>complete()Completes the write operation and returns a queue ofAllocatedBufferobjects in forward-writing order.private static bytecomputeUInt64SizeNoTag(long value)Not using the version in CodedOutputStream due to the fact that benchmarks have shown a performance improvement when returning a byte (rather than an int).Writer.FieldOrderfieldOrder()Indicates the order in which the fields are written by thisWriter.(package private) abstract voidfinishCurrentBuffer()abstract intgetTotalBytesWritten()Gets the total number of bytes that have been written.(package private) static booleanisUnsafeDirectSupported()(package private) static booleanisUnsafeHeapSupported()(package private) AllocatedBuffernewDirectBuffer()(package private) AllocatedBuffernewDirectBuffer(int capacity)static BinaryWriternewDirectInstance(BufferAllocator alloc)Creates a newBinaryWriterthat will allocate direct (i.e.static BinaryWriternewDirectInstance(BufferAllocator alloc, int chunkSize)Creates a newBinaryWriterthat will allocate direct (i.e.(package private) AllocatedBuffernewHeapBuffer()(package private) AllocatedBuffernewHeapBuffer(int capacity)static BinaryWriternewHeapInstance(BufferAllocator alloc)Creates a newBinaryWriterthat will allocate heap buffers ofDEFAULT_CHUNK_SIZEas necessary.static BinaryWriternewHeapInstance(BufferAllocator alloc, int chunkSize)Creates a newBinaryWriterthat will allocate heap buffers ofchunkSizeas necessary.(package private) static BinaryWriternewSafeDirectInstance(BufferAllocator alloc, int chunkSize)(package private) static BinaryWriternewSafeHeapInstance(BufferAllocator alloc, int chunkSize)(package private) static BinaryWriternewUnsafeDirectInstance(BufferAllocator alloc, int chunkSize)(package private) static BinaryWriternewUnsafeHeapInstance(BufferAllocator alloc, int chunkSize)(package private) abstract voidrequireSpace(int size)(package private) abstract voidwriteBool(boolean value)voidwriteBoolList(int fieldNumber, java.util.List<java.lang.Boolean> list, boolean packed)Writes a list field of typeFieldType.BOOL.private voidwriteBoolList_Internal(int fieldNumber, BooleanArrayList list, boolean packed)private voidwriteBoolList_Internal(int fieldNumber, java.util.List<java.lang.Boolean> list, boolean packed)voidwriteBytesList(int fieldNumber, java.util.List<ByteString> list)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> list, boolean packed)Writes a list field of typeFieldType.DOUBLE.private voidwriteDoubleList_Internal(int fieldNumber, DoubleArrayList list, boolean packed)private voidwriteDoubleList_Internal(int fieldNumber, java.util.List<java.lang.Double> list, boolean packed)voidwriteEnum(int fieldNumber, int value)Writes a field of typeFieldType.ENUM.voidwriteEnumList(int fieldNumber, java.util.List<java.lang.Integer> list, boolean packed)Writes a list field of typeFieldType.ENUM.(package private) abstract voidwriteFixed32(int value)voidwriteFixed32List(int fieldNumber, java.util.List<java.lang.Integer> list, boolean packed)Writes a list field of typeFieldType.FIXED32.private voidwriteFixed32List_Internal(int fieldNumber, IntArrayList list, boolean packed)private voidwriteFixed32List_Internal(int fieldNumber, java.util.List<java.lang.Integer> list, boolean packed)(package private) abstract voidwriteFixed64(long value)voidwriteFixed64List(int fieldNumber, java.util.List<java.lang.Long> list, boolean packed)Writes a list field of typeFieldType.FIXED64.private voidwriteFixed64List_Internal(int fieldNumber, LongArrayList list, boolean packed)private voidwriteFixed64List_Internal(int fieldNumber, java.util.List<java.lang.Long> list, boolean packed)voidwriteFloat(int fieldNumber, float value)Writes a field of typeFieldType.FLOAT.voidwriteFloatList(int fieldNumber, java.util.List<java.lang.Float> list, boolean packed)Writes a list field of typeFieldType.FLOAT.private voidwriteFloatList_Internal(int fieldNumber, FloatArrayList list, boolean packed)private voidwriteFloatList_Internal(int fieldNumber, java.util.List<java.lang.Float> list, boolean packed)voidwriteGroupList(int fieldNumber, java.util.List<?> list)Deprecated.voidwriteGroupList(int fieldNumber, java.util.List<?> list, Schema schema)Deprecated.(package private) abstract voidwriteInt32(int value)voidwriteInt32List(int fieldNumber, java.util.List<java.lang.Integer> list, boolean packed)Writes a list field of typeFieldType.INT32.private voidwriteInt32List_Internal(int fieldNumber, IntArrayList list, boolean packed)private voidwriteInt32List_Internal(int fieldNumber, java.util.List<java.lang.Integer> list, boolean packed)voidwriteInt64(int fieldNumber, long value)Writes a field of typeFieldType.INT64.voidwriteInt64List(int fieldNumber, java.util.List<java.lang.Long> list, boolean packed)Writes a list field of typeFieldType.INT64.private voidwriteLazyString(int fieldNumber, java.lang.Object value)<K,V>
voidwriteMap(int fieldNumber, MapEntryLite.Metadata<K,V> metadata, java.util.Map<K,V> map)Writes a map field.(package private) static voidwriteMapEntryField(Writer writer, int fieldNumber, WireFormat.FieldType fieldType, java.lang.Object object)voidwriteMessageList(int fieldNumber, java.util.List<?> list)Writes a list field of typeFieldType.MESSAGE.voidwriteMessageList(int fieldNumber, java.util.List<?> list, 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> list, 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> list, boolean packed)Writes a list field of typeFieldType.SFIXED64.(package private) abstract voidwriteSInt32(int value)voidwriteSInt32List(int fieldNumber, java.util.List<java.lang.Integer> list, boolean packed)Writes a list field of typeFieldType.SINT32.private voidwriteSInt32List_Internal(int fieldNumber, IntArrayList list, boolean packed)private voidwriteSInt32List_Internal(int fieldNumber, java.util.List<java.lang.Integer> list, boolean packed)(package private) abstract voidwriteSInt64(long value)voidwriteSInt64List(int fieldNumber, java.util.List<java.lang.Long> list, boolean packed)Writes a list field of typeFieldType.SINT64.private voidwriteSInt64List_Internal(int fieldNumber, LongArrayList list, boolean packed)private voidwriteSInt64List_Internal(int fieldNumber, java.util.List<java.lang.Long> list, boolean packed)(package private) abstract voidwriteString(java.lang.String in)voidwriteStringList(int fieldNumber, java.util.List<java.lang.String> list)Writes a list field of typeFieldType.STRING.(package private) abstract voidwriteTag(int fieldNumber, int wireType)voidwriteUInt32List(int fieldNumber, java.util.List<java.lang.Integer> list, boolean packed)Writes a list field of typeFieldType.UINT32.private voidwriteUInt32List_Internal(int fieldNumber, IntArrayList list, boolean packed)private voidwriteUInt32List_Internal(int fieldNumber, java.util.List<java.lang.Integer> list, boolean packed)voidwriteUInt64List(int fieldNumber, java.util.List<java.lang.Long> list, boolean packed)Writes a list field of typeFieldType.UINT64.private voidwriteUInt64List_Internal(int fieldNumber, LongArrayList list, boolean packed)private voidwriteUInt64List_Internal(int fieldNumber, java.util.List<java.lang.Long> list, boolean packed)(package private) abstract voidwriteVarint32(int value)(package private) abstract voidwriteVarint64(long value)-
Methods inherited from class com.google.protobuf.ByteOutput
write, write, write, writeLazy, writeLazy
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.google.protobuf.Writer
writeBool, writeBytes, writeEndGroup, writeFixed32, writeFixed64, writeGroup, writeGroup, writeInt32, writeMessage, writeMessage, writeSInt32, writeSInt64, writeStartGroup, writeString, writeUInt32, writeUInt64
-
-
-
-
Field Detail
-
DEFAULT_CHUNK_SIZE
public static final int DEFAULT_CHUNK_SIZE
- See Also:
- Constant Field Values
-
alloc
private final BufferAllocator alloc
-
chunkSize
private final int chunkSize
-
buffers
final java.util.ArrayDeque<AllocatedBuffer> buffers
-
totalDoneBytes
int totalDoneBytes
-
MAP_KEY_NUMBER
private static final int MAP_KEY_NUMBER
- See Also:
- Constant Field Values
-
MAP_VALUE_NUMBER
private static final int MAP_VALUE_NUMBER
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
BinaryWriter
private BinaryWriter(BufferAllocator alloc, int chunkSize)
Only allow subclassing for inner classes.
-
-
Method Detail
-
newHeapInstance
public static BinaryWriter newHeapInstance(BufferAllocator alloc)
Creates a newBinaryWriterthat will allocate heap buffers ofDEFAULT_CHUNK_SIZEas necessary.
-
newHeapInstance
public static BinaryWriter newHeapInstance(BufferAllocator alloc, int chunkSize)
Creates a newBinaryWriterthat will allocate heap buffers ofchunkSizeas necessary.
-
newDirectInstance
public static BinaryWriter newDirectInstance(BufferAllocator alloc)
Creates a newBinaryWriterthat will allocate direct (i.e. non-heap) buffers ofDEFAULT_CHUNK_SIZEas necessary.
-
newDirectInstance
public static BinaryWriter newDirectInstance(BufferAllocator alloc, int chunkSize)
Creates a newBinaryWriterthat will allocate direct (i.e. non-heap) buffers ofchunkSizeas necessary.
-
isUnsafeHeapSupported
static boolean isUnsafeHeapSupported()
-
isUnsafeDirectSupported
static boolean isUnsafeDirectSupported()
-
newSafeHeapInstance
static BinaryWriter newSafeHeapInstance(BufferAllocator alloc, int chunkSize)
-
newUnsafeHeapInstance
static BinaryWriter newUnsafeHeapInstance(BufferAllocator alloc, int chunkSize)
-
newSafeDirectInstance
static BinaryWriter newSafeDirectInstance(BufferAllocator alloc, int chunkSize)
-
newUnsafeDirectInstance
static BinaryWriter newUnsafeDirectInstance(BufferAllocator alloc, int chunkSize)
-
fieldOrder
public final Writer.FieldOrder fieldOrder()
Description copied from interface:WriterIndicates the order in which the fields are written by thisWriter.- Specified by:
fieldOrderin interfaceWriter
-
complete
@CanIgnoreReturnValue public final java.util.Queue<AllocatedBuffer> complete()
Completes the write operation and returns a queue ofAllocatedBufferobjects in forward-writing order. This method should only be called once.After calling this method, the writer can not be reused. Create a new writer for future writes.
-
writeSFixed32
public final void writeSFixed32(int fieldNumber, int value) throws java.io.IOExceptionDescription copied from interface:WriterWrites a field of typeFieldType.SFIXED32.- Specified by:
writeSFixed32in interfaceWriter- Throws:
java.io.IOException
-
writeInt64
public final void writeInt64(int fieldNumber, long value) throws java.io.IOExceptionDescription copied from interface:WriterWrites a field of typeFieldType.INT64.- Specified by:
writeInt64in interfaceWriter- Throws:
java.io.IOException
-
writeSFixed64
public final void writeSFixed64(int fieldNumber, long value) throws java.io.IOExceptionDescription copied from interface:WriterWrites a field of typeFieldType.SFIXED64.- Specified by:
writeSFixed64in interfaceWriter- Throws:
java.io.IOException
-
writeFloat
public final void writeFloat(int fieldNumber, float value) throws java.io.IOExceptionDescription copied from interface:WriterWrites a field of typeFieldType.FLOAT.- Specified by:
writeFloatin interfaceWriter- Throws:
java.io.IOException
-
writeDouble
public final void writeDouble(int fieldNumber, double value) throws java.io.IOExceptionDescription copied from interface:WriterWrites a field of typeFieldType.DOUBLE.- Specified by:
writeDoublein interfaceWriter- Throws:
java.io.IOException
-
writeEnum
public final void writeEnum(int fieldNumber, int value) throws java.io.IOExceptionDescription copied from interface:WriterWrites a field of typeFieldType.ENUM.
-
writeInt32List
public final void writeInt32List(int fieldNumber, java.util.List<java.lang.Integer> list, boolean packed) throws java.io.IOExceptionDescription copied from interface:WriterWrites a list field of typeFieldType.INT32.- Specified by:
writeInt32Listin interfaceWriter- Throws:
java.io.IOException
-
writeInt32List_Internal
private void writeInt32List_Internal(int fieldNumber, java.util.List<java.lang.Integer> list, boolean packed) throws java.io.IOException- Throws:
java.io.IOException
-
writeInt32List_Internal
private void writeInt32List_Internal(int fieldNumber, IntArrayList list, boolean packed) throws java.io.IOException- Throws:
java.io.IOException
-
writeFixed32List
public final void writeFixed32List(int fieldNumber, java.util.List<java.lang.Integer> list, boolean packed) throws java.io.IOExceptionDescription copied from interface:WriterWrites a list field of typeFieldType.FIXED32.- Specified by:
writeFixed32Listin interfaceWriter- Throws:
java.io.IOException
-
writeFixed32List_Internal
private void writeFixed32List_Internal(int fieldNumber, java.util.List<java.lang.Integer> list, boolean packed) throws java.io.IOException- Throws:
java.io.IOException
-
writeFixed32List_Internal
private void writeFixed32List_Internal(int fieldNumber, IntArrayList list, boolean packed) throws java.io.IOException- Throws:
java.io.IOException
-
writeInt64List
public final void writeInt64List(int fieldNumber, java.util.List<java.lang.Long> list, boolean packed) throws java.io.IOExceptionDescription copied from interface:WriterWrites a list field of typeFieldType.INT64.- Specified by:
writeInt64Listin interfaceWriter- Throws:
java.io.IOException
-
writeUInt64List
public final void writeUInt64List(int fieldNumber, java.util.List<java.lang.Long> list, boolean packed) throws java.io.IOExceptionDescription copied from interface:WriterWrites a list field of typeFieldType.UINT64.- Specified by:
writeUInt64Listin interfaceWriter- Throws:
java.io.IOException
-
writeUInt64List_Internal
private void writeUInt64List_Internal(int fieldNumber, java.util.List<java.lang.Long> list, boolean packed) throws java.io.IOException- Throws:
java.io.IOException
-
writeUInt64List_Internal
private void writeUInt64List_Internal(int fieldNumber, LongArrayList list, boolean packed) throws java.io.IOException- Throws:
java.io.IOException
-
writeFixed64List
public final void writeFixed64List(int fieldNumber, java.util.List<java.lang.Long> list, boolean packed) throws java.io.IOExceptionDescription copied from interface:WriterWrites a list field of typeFieldType.FIXED64.- Specified by:
writeFixed64Listin interfaceWriter- Throws:
java.io.IOException
-
writeFixed64List_Internal
private void writeFixed64List_Internal(int fieldNumber, java.util.List<java.lang.Long> list, boolean packed) throws java.io.IOException- Throws:
java.io.IOException
-
writeFixed64List_Internal
private void writeFixed64List_Internal(int fieldNumber, LongArrayList list, boolean packed) throws java.io.IOException- Throws:
java.io.IOException
-
writeFloatList
public final void writeFloatList(int fieldNumber, java.util.List<java.lang.Float> list, boolean packed) throws java.io.IOExceptionDescription copied from interface:WriterWrites a list field of typeFieldType.FLOAT.- Specified by:
writeFloatListin interfaceWriter- Throws:
java.io.IOException
-
writeFloatList_Internal
private void writeFloatList_Internal(int fieldNumber, java.util.List<java.lang.Float> list, boolean packed) throws java.io.IOException- Throws:
java.io.IOException
-
writeFloatList_Internal
private void writeFloatList_Internal(int fieldNumber, FloatArrayList list, boolean packed) throws java.io.IOException- Throws:
java.io.IOException
-
writeDoubleList
public final void writeDoubleList(int fieldNumber, java.util.List<java.lang.Double> list, boolean packed) throws java.io.IOExceptionDescription copied from interface:WriterWrites a list field of typeFieldType.DOUBLE.- Specified by:
writeDoubleListin interfaceWriter- Throws:
java.io.IOException
-
writeDoubleList_Internal
private void writeDoubleList_Internal(int fieldNumber, java.util.List<java.lang.Double> list, boolean packed) throws java.io.IOException- Throws:
java.io.IOException
-
writeDoubleList_Internal
private void writeDoubleList_Internal(int fieldNumber, DoubleArrayList list, boolean packed) throws java.io.IOException- Throws:
java.io.IOException
-
writeEnumList
public final void writeEnumList(int fieldNumber, java.util.List<java.lang.Integer> list, boolean packed) throws java.io.IOExceptionDescription copied from interface:WriterWrites a list field of typeFieldType.ENUM.- Specified by:
writeEnumListin interfaceWriter- Throws:
java.io.IOException
-
writeBoolList
public final void writeBoolList(int fieldNumber, java.util.List<java.lang.Boolean> list, boolean packed) throws java.io.IOExceptionDescription copied from interface:WriterWrites a list field of typeFieldType.BOOL.- Specified by:
writeBoolListin interfaceWriter- Throws:
java.io.IOException
-
writeBoolList_Internal
private void writeBoolList_Internal(int fieldNumber, java.util.List<java.lang.Boolean> list, boolean packed) throws java.io.IOException- Throws:
java.io.IOException
-
writeBoolList_Internal
private void writeBoolList_Internal(int fieldNumber, BooleanArrayList list, boolean packed) throws java.io.IOException- Throws:
java.io.IOException
-
writeStringList
public final void writeStringList(int fieldNumber, java.util.List<java.lang.String> list) throws java.io.IOExceptionDescription copied from interface:WriterWrites a list field of typeFieldType.STRING.- Specified by:
writeStringListin interfaceWriter- Throws:
java.io.IOException
-
writeLazyString
private void writeLazyString(int fieldNumber, java.lang.Object value) throws java.io.IOException- Throws:
java.io.IOException
-
writeBytesList
public final void writeBytesList(int fieldNumber, java.util.List<ByteString> list) throws java.io.IOExceptionDescription copied from interface:WriterWrites a list field of typeFieldType.BYTES.- Specified by:
writeBytesListin interfaceWriter- Throws:
java.io.IOException
-
writeUInt32List
public final void writeUInt32List(int fieldNumber, java.util.List<java.lang.Integer> list, boolean packed) throws java.io.IOExceptionDescription copied from interface:WriterWrites a list field of typeFieldType.UINT32.- Specified by:
writeUInt32Listin interfaceWriter- Throws:
java.io.IOException
-
writeUInt32List_Internal
private void writeUInt32List_Internal(int fieldNumber, java.util.List<java.lang.Integer> list, boolean packed) throws java.io.IOException- Throws:
java.io.IOException
-
writeUInt32List_Internal
private void writeUInt32List_Internal(int fieldNumber, IntArrayList list, boolean packed) throws java.io.IOException- Throws:
java.io.IOException
-
writeSFixed32List
public final void writeSFixed32List(int fieldNumber, java.util.List<java.lang.Integer> list, boolean packed) throws java.io.IOExceptionDescription copied from interface:WriterWrites a list field of typeFieldType.SFIXED32.- Specified by:
writeSFixed32Listin interfaceWriter- Throws:
java.io.IOException
-
writeSFixed64List
public final void writeSFixed64List(int fieldNumber, java.util.List<java.lang.Long> list, boolean packed) throws java.io.IOExceptionDescription copied from interface:WriterWrites a list field of typeFieldType.SFIXED64.- Specified by:
writeSFixed64Listin interfaceWriter- Throws:
java.io.IOException
-
writeSInt32List
public final void writeSInt32List(int fieldNumber, java.util.List<java.lang.Integer> list, boolean packed) throws java.io.IOExceptionDescription copied from interface:WriterWrites a list field of typeFieldType.SINT32.- Specified by:
writeSInt32Listin interfaceWriter- Throws:
java.io.IOException
-
writeSInt32List_Internal
private void writeSInt32List_Internal(int fieldNumber, java.util.List<java.lang.Integer> list, boolean packed) throws java.io.IOException- Throws:
java.io.IOException
-
writeSInt32List_Internal
private void writeSInt32List_Internal(int fieldNumber, IntArrayList list, boolean packed) throws java.io.IOException- Throws:
java.io.IOException
-
writeSInt64List
public final void writeSInt64List(int fieldNumber, java.util.List<java.lang.Long> list, boolean packed) throws java.io.IOExceptionDescription copied from interface:WriterWrites a list field of typeFieldType.SINT64.- Specified by:
writeSInt64Listin interfaceWriter- Throws:
java.io.IOException
-
writeMap
public <K,V> void writeMap(int fieldNumber, MapEntryLite.Metadata<K,V> metadata, java.util.Map<K,V> map) throws java.io.IOExceptionDescription copied from interface:WriterWrites a map field.
-
writeMapEntryField
static final void writeMapEntryField(Writer writer, int fieldNumber, WireFormat.FieldType fieldType, java.lang.Object object) throws java.io.IOException
- Throws:
java.io.IOException
-
writeSInt64List_Internal
private void writeSInt64List_Internal(int fieldNumber, java.util.List<java.lang.Long> list, boolean packed) throws java.io.IOException- Throws:
java.io.IOException
-
writeSInt64List_Internal
private void writeSInt64List_Internal(int fieldNumber, LongArrayList list, boolean packed) throws java.io.IOException- Throws:
java.io.IOException
-
writeMessageList
public final void writeMessageList(int fieldNumber, java.util.List<?> list) throws java.io.IOExceptionDescription copied from interface:WriterWrites a list field of typeFieldType.MESSAGE.- Specified by:
writeMessageListin interfaceWriter- Throws:
java.io.IOException
-
writeMessageList
public final void writeMessageList(int fieldNumber, java.util.List<?> list, Schema schema) throws java.io.IOExceptionDescription copied from interface:WriterWrites a list field of typeFieldType.MESSAGE.- Specified by:
writeMessageListin interfaceWriter- Throws:
java.io.IOException
-
writeGroupList
@Deprecated public final void writeGroupList(int fieldNumber, java.util.List<?> list) throws java.io.IOExceptionDeprecated.Description copied from interface:WriterWrites a list field of typeFieldType.GROUP.- Specified by:
writeGroupListin interfaceWriter- Throws:
java.io.IOException
-
writeGroupList
@Deprecated public final void writeGroupList(int fieldNumber, java.util.List<?> list, Schema schema) throws java.io.IOExceptionDeprecated.Description copied from interface:WriterWrites a list field of typeFieldType.GROUP.- Specified by:
writeGroupListin interfaceWriter- Throws:
java.io.IOException
-
writeMessageSetItem
public final void writeMessageSetItem(int fieldNumber, java.lang.Object value) throws java.io.IOExceptionDescription copied from interface:WriterWrites a message field inMessageSetwire-format.- Specified by:
writeMessageSetItemin interfaceWritervalue- A message instance or an opaqueByteStringfor an unknown field.- Throws:
java.io.IOException
-
newHeapBuffer
final AllocatedBuffer newHeapBuffer()
-
newHeapBuffer
final AllocatedBuffer newHeapBuffer(int capacity)
-
newDirectBuffer
final AllocatedBuffer newDirectBuffer()
-
newDirectBuffer
final AllocatedBuffer newDirectBuffer(int capacity)
-
getTotalBytesWritten
public abstract int getTotalBytesWritten()
Gets the total number of bytes that have been written. This will not be reset by a call tocomplete().
-
requireSpace
abstract void requireSpace(int size)
-
finishCurrentBuffer
abstract void finishCurrentBuffer()
-
writeTag
abstract void writeTag(int fieldNumber, int wireType)
-
writeVarint32
abstract void writeVarint32(int value)
-
writeInt32
abstract void writeInt32(int value)
-
writeSInt32
abstract void writeSInt32(int value)
-
writeFixed32
abstract void writeFixed32(int value)
-
writeVarint64
abstract void writeVarint64(long value)
-
writeSInt64
abstract void writeSInt64(long value)
-
writeFixed64
abstract void writeFixed64(long value)
-
writeBool
abstract void writeBool(boolean value)
-
writeString
abstract void writeString(java.lang.String in)
-
computeUInt64SizeNoTag
private static byte computeUInt64SizeNoTag(long value)
Not using the version in CodedOutputStream due to the fact that benchmarks have shown a performance improvement when returning a byte (rather than an int).
-
-