This class contains two kinds of methods: methods that write specific protocol message
constructs and field types (e.g. writeTag and writeInt32) and methods that
write low-level values (e.g. writeRawVarint32 and writeRawBytes). If you are
writing encoded protocol messages, you should use the former methods, but if you are writing some
other format of your own design, use the latter.
This class is totally unsynchronized.
| Modifier and Type | Class and Description |
|---|---|
| private abstract static class | CodedOutputStream.AbstractBufferedEncoder
Abstract base class for buffered encoders. |
| private static class | CodedOutputStream.ArrayEncoder
A |
| private static class | CodedOutputStream.ByteOutputEncoder
A |
| private static class | CodedOutputStream.HeapNioEncoder
A |
| public static class | CodedOutputStream.OutOfSpaceException
If you create a CodedOutputStream around a simple flat array, you must not attempt to write more bytes than the array has space. |
| private static class | CodedOutputStream.OutputStreamEncoder
An |
| private static class | CodedOutputStream.SafeDirectNioEncoder
A |
| private static class | CodedOutputStream.UnsafeDirectNioEncoder
A |
| Modifier and Type | Field and Description |
|---|---|
| public static final int | DEFAULT_BUFFER_SIZE
The buffer size used in |
| private static final boolean | |
| public static final int | LITTLE_ENDIAN_32_SIZE
Deprecated
Use
computeFixed32SizeNoTag(int) instead.
|
| private static final Logger | |
| private boolean |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public final void | |
| public static int | computeBoolSize(final int fieldNumber, final boolean value)
Compute the number of bytes that would be needed to encode a |
| public static int | computeBoolSizeNoTag(final boolean unused)
Compute the number of bytes that would be needed to encode a |
| public static int | computeByteArraySize(final int fieldNumber, final byte[] value)
Compute the number of bytes that would be needed to encode a |
| public static int | computeByteArraySizeNoTag(final byte[] value)
Compute the number of bytes that would be needed to encode a |
| public static int | computeByteBufferSize(final int fieldNumber, final ByteBuffer value)
Compute the number of bytes that would be needed to encode a |
| public static int | computeByteBufferSizeNoTag(final ByteBuffer value)
Compute the number of bytes that would be needed to encode a |
| public static int | computeBytesSize(final int fieldNumber, final ByteString value)
Compute the number of bytes that would be needed to encode a |
| public static int | computeBytesSizeNoTag(final ByteString value)
Compute the number of bytes that would be needed to encode a |
| public static int | computeDoubleSize(final int fieldNumber, final double value)
Compute the number of bytes that would be needed to encode a |
| public static int | computeDoubleSizeNoTag(final double unused)
Compute the number of bytes that would be needed to encode a |
| public static int | computeEnumSize(final int fieldNumber, final int value)
Compute the number of bytes that would be needed to encode an enum field, including tag. |
| public static int | computeEnumSizeNoTag(final int value)
Compute the number of bytes that would be needed to encode an enum field. |
| public static int | computeFixed32Size(final int fieldNumber, final int value)
Compute the number of bytes that would be needed to encode a |
| public static int | computeFixed32SizeNoTag(final int unused)
Compute the number of bytes that would be needed to encode a |
| public static int | computeFixed64Size(final int fieldNumber, final long value)
Compute the number of bytes that would be needed to encode a |
| public static int | computeFixed64SizeNoTag(final long unused)
Compute the number of bytes that would be needed to encode a |
| public static int | computeFloatSize(final int fieldNumber, final float value)
Compute the number of bytes that would be needed to encode a |
| public static int | computeFloatSizeNoTag(final float unused)
Compute the number of bytes that would be needed to encode a |
| public static int | computeGroupSize(final int fieldNumber, final MessageLite value)
Deprecated
groups are deprecated.
Compute the number of bytes that would be needed to encode a group field, including
tag.
|
| public static int | computeGroupSizeNoTag(final MessageLite value)
Deprecated
Compute the number of bytes that would be needed to encode a group field.
|
| public static int | computeInt32Size(final int fieldNumber, final int value)
Compute the number of bytes that would be needed to encode an |
| public static int | computeInt32SizeNoTag(final int value)
Compute the number of bytes that would be needed to encode an |
| public static int | computeInt64Size(final int fieldNumber, final long value)
Compute the number of bytes that would be needed to encode an |
| public static int | computeInt64SizeNoTag(final long value)
Compute the number of bytes that would be needed to encode an |
| public static int | computeLazyFieldMessageSetExtensionSize(final int fieldNumber, final LazyFieldLite value)
Compute the number of bytes that would be needed to encode an lazily parsed MessageSet extension field to the stream. |
| public static int | computeLazyFieldSize(final int fieldNumber, final LazyFieldLite value)
Compute the number of bytes that would be needed to encode an embedded message in lazy field, including tag. |
| public static int | computeLazyFieldSizeNoTag(final LazyFieldLite value)
Compute the number of bytes that would be needed to encode an embedded message stored in lazy field. |
| pack-priv static int | |
| public static int | computeMessageSetExtensionSize(final int fieldNumber, final MessageLite value)
Compute the number of bytes that would be needed to encode a MessageSet extension to the stream. |
| public static int | computeMessageSize(final int fieldNumber, final MessageLite value)
Compute the number of bytes that would be needed to encode an embedded message field, including tag. |
| public static int | computeMessageSizeNoTag(final MessageLite value)
Compute the number of bytes that would be needed to encode an embedded message field. |
| pack-priv static int | Returns: the buffer size to efficiently write dataLength bytes to this CodedOutputStream.Returns the buffer size to efficiently write dataLength bytes to this CodedOutputStream. |
| public static int | computeRawMessageSetExtensionSize(final int fieldNumber, final ByteString value)
Compute the number of bytes that would be needed to encode an unparsed MessageSet extension field to the stream. |
| public static int | computeRawVarint32Size(final int value)
Deprecated
use
Compute the number of bytes that would be needed to encode a varint.
computeUInt32SizeNoTag(int) instead.
|
| public static int | computeRawVarint64Size(long value)
Deprecated
use
Compute the number of bytes that would be needed to encode a varint.
computeUInt64SizeNoTag(long) instead.
|
| public static int | computeSFixed32Size(final int fieldNumber, final int value)
Compute the number of bytes that would be needed to encode an |
| public static int | computeSFixed32SizeNoTag(final int unused)
Compute the number of bytes that would be needed to encode an |
| public static int | computeSFixed64Size(final int fieldNumber, final long value)
Compute the number of bytes that would be needed to encode an |
| public static int | computeSFixed64SizeNoTag(final long unused)
Compute the number of bytes that would be needed to encode an |
| public static int | computeSInt32Size(final int fieldNumber, final int value)
Compute the number of bytes that would be needed to encode an |
| public static int | computeSInt32SizeNoTag(final int value)
Compute the number of bytes that would be needed to encode an |
| public static int | computeSInt64Size(final int fieldNumber, final long value)
Compute the number of bytes that would be needed to encode an |
| public static int | computeSInt64SizeNoTag(final long value)
Compute the number of bytes that would be needed to encode an |
| public static int | computeStringSize(final int fieldNumber, final String value)
Compute the number of bytes that would be needed to encode a |
| public static int | computeStringSizeNoTag(final String value)
Compute the number of bytes that would be needed to encode a |
| public static int | computeTagSize(final int fieldNumber)
Compute the number of bytes that would be needed to encode a tag. |
| public static int | computeUInt32Size(final int fieldNumber, final int value)
Compute the number of bytes that would be needed to encode a |
| public static int | computeUInt32SizeNoTag(final int value)
Compute the number of bytes that would be needed to encode a |
| public static int | computeUInt64Size(final int fieldNumber, final long value)
Compute the number of bytes that would be needed to encode a |
| public static int | computeUInt64SizeNoTag(long value)
Compute the number of bytes that would be needed to encode a |
| public static int | Returns: An unsigned 32-bit integer, stored in a signed int because Java has no explicit unsigned support.A signed 32-bit integer. n)Encode a ZigZag-encoded 32-bit value. |
| public static long | Returns: An unsigned 64-bit integer, stored in a signed int because Java has no explicit unsigned support.A signed 64-bit integer. n)Encode a ZigZag-encoded 64-bit value. |
| public abstract void | |
| public abstract int | |
| pack-priv final void | |
| pack-priv boolean | |
| public static CodedOutputStream | newInstance(final OutputStream output)
Create a new |
| public static CodedOutputStream | newInstance(final OutputStream output, final int bufferSize)
Create a new |
| public static CodedOutputStream | newInstance(final byte[] flatArray)
Create a new |
| public static CodedOutputStream | newInstance(final byte[] flatArray, final int offset, final int length)
Create a new |
| public static CodedOutputStream | |
| public static CodedOutputStream | newInstance(ByteBuffer byteBuffer, int unused)
Deprecated
the size parameter is no longer used since use of an internal buffer is useless
(and wasteful) when writing to a
Create a new ByteBuffer.
CodedOutputStream that writes to the given ByteBuffer.
|
| pack-priv static CodedOutputStream | newInstance(ByteOutput
the output target for encoded bytes. byteOutput, int the size of the internal scratch buffer to be used for string encoding.
Setting this to bufferSize)0 will disable buffering, requiring an allocation for each encoded
string.Create a new |
| pack-priv static CodedOutputStream | |
| pack-priv static CodedOutputStream | |
| public abstract int | |
| public void | |
| public abstract void | write(byte
the byte to be written value)Implements abstract com. |
| public abstract void | write(byte[]
the bytes to be written value, int the offset of the start of the writable range offset, int the number of bytes to write starting from length)offsetImplements abstract com. |
| public abstract void | write(ByteBuffer
the bytes to be written. Upon returning from this call, the value)position of
this buffer will be set to the limitImplements abstract com. |
| public abstract void | |
| public final void | |
| public abstract void | |
| public abstract void | writeByteArray(int fieldNumber, byte[] value, int offset, int length)
Write a |
| public final void | |
| pack-priv abstract void | writeByteArrayNoTag(final byte[] value, final int offset, final int length)
Write a |
| public abstract void | writeByteBuffer(int fieldNumber, ByteBuffer value)
Write a |
| public abstract void | |
| public abstract void | |
| public final void | writeDouble(final int fieldNumber, final double value)
Write a |
| public final void | |
| public final void | |
| public final void | |
| public abstract void | |
| public abstract void | |
| public abstract void | |
| public abstract void | |
| public final void | writeFloat(final int fieldNumber, final float value)
Write a |
| public final void | |
| public final void | writeGroup(final int fieldNumber, final MessageLite value)
Deprecated
groups are deprecated.
Write a group field, including tag, to the stream.
|
| public final void | writeGroupNoTag(final MessageLite value)
Deprecated
groups are deprecated.
Write a group field to the stream.
|
| public abstract void | |
| public abstract void | |
| public final void | writeInt64(final int fieldNumber, final long value)
Write an |
| public final void | |
| public abstract void | writeLazy(byte[]
the bytes to be written value, int the offset of the start of the writable range offset, int the number of bytes to write starting from length)offsetImplements abstract com. |
| public abstract void | writeLazy(ByteBuffer
the bytes to be written. Upon returning from this call, the value)position of
this buffer will be set to the limitImplements abstract com. |
| public abstract void | writeMessage(final int fieldNumber, final MessageLite value)
Write an embedded message field, including tag, to the stream. |
| public abstract void | |
| public abstract void | writeMessageSetExtension(final int fieldNumber, final MessageLite value)
Write a MessageSet extension field to the stream. |
| public final void | |
| public final void | |
| public final void | |
| public final void | |
| public final void | |
| public abstract void | |
| public final void | writeRawLittleEndian32(final int value)
Deprecated
Use
Write a little-endian 32-bit integer.
writeFixed32NoTag instead.
|
| public final void | writeRawLittleEndian64(final long value)
Deprecated
Use
Write a little-endian 64-bit integer.
writeFixed64NoTag instead.
|
| public abstract void | writeRawMessageSetExtension(final int fieldNumber, final ByteString value)
Write an unparsed MessageSet extension field to the stream. |
| public final void | |
| public final void | |
| public final void | writeSFixed32(final int fieldNumber, final int value)
Write an |
| public final void | |
| public final void | writeSFixed64(final int fieldNumber, final long value)
Write an |
| public final void | |
| public final void | writeSInt32(final int fieldNumber, final int value)
Write a |
| public final void | |
| public final void | writeSInt64(final int fieldNumber, final long value)
Write an |
| public final void | |
| public abstract void | |
| public abstract void | |
| public abstract void | |
| public abstract void | |
| public abstract void | |
| public abstract void | |
| public abstract void |