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 |
|---|---|
| public static class | CodedOutputByteBufferNano.OutOfSpaceException
If you create a CodedOutputStream around a simple flat array, you must not attempt to write more bytes than the array has space. |
| Modifier and Type | Field and Description |
|---|---|
| private final ByteBuffer | |
| public static final int | |
| public static final int | |
| private static final int |
| Access | Constructor and Description |
|---|---|
| private | |
| private |
| Modifier and Type | Method and Description |
|---|---|
| public 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 value)
Compute the number of bytes that would be needed to encode a
|
| public static int | computeBytesSize(final int fieldNumber, final byte[] value)
Compute the number of bytes that would be needed to encode a
|
| public static int | computeBytesSizeNoTag(final byte[] 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 value)
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. |
| pack-priv static int | |
| 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 value)
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 value)
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 value)
Compute the number of bytes that would be needed to encode a
|
| public static int | computeGroupSize(final int fieldNumber, final MessageNano value)
Compute the number of bytes that would be needed to encode a
|
| public static int | computeGroupSizeNoTag(final MessageNano value)
Compute the number of bytes that would be needed to encode a
|
| 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 | computeMessageSize(final int fieldNumber, final MessageNano value)
Compute the number of bytes that would be needed to encode an embedded message field, including tag. |
| public static int | computeMessageSizeNoTag(final MessageNano value)
Compute the number of bytes that would be needed to encode an embedded message field. |
| public static int | computeRawVarint32Size(final int value)
Compute the number of bytes that would be needed to encode a varint. |
| public static int | computeRawVarint64Size(final long value)
Compute the number of bytes that would be needed to encode a varint. |
| 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 value)
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 value)
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(final long value)
Compute the number of bytes that would be needed to encode a
|
| private static void | |
| private static int | |
| private static void | |
| private static int | encodedLength(CharSequence sequence)
Returns the number of bytes in the UTF-8-encoded form of |
| private static int | |
| 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 static CodedOutputByteBufferNano | newInstance(final byte[] flatArray)
Create a new |
| public static CodedOutputByteBufferNano | newInstance(final byte[] flatArray, final int offset, final int length)
Create a new |
| public int | |
| public void | |
| public int | |
| public void | writeBool(final int fieldNumber, final boolean value)
Write a |
| public void | |
| public void | writeBytes(final int fieldNumber, final byte[] value)
Write a |
| public void | |
| public void | writeDouble(final int fieldNumber, final double value)
Write a |
| public void | |
| public void | |
| public void | |
| pack-priv void | |
| public void | writeFixed32(final int fieldNumber, final int value)
Write a |
| public void | |
| public void | writeFixed64(final int fieldNumber, final long value)
Write a |
| public void | |
| public void | writeFloat(final int fieldNumber, final float value)
Write a |
| public void | |
| public void | writeGroup(final int fieldNumber, final MessageNano value)
Write a |
| public void | |
| public void | writeInt32(final int fieldNumber, final int value)
Write an |
| public void | |
| public void | writeInt64(final int fieldNumber, final long value)
Write an |
| public void | |
| public void | writeMessage(final int fieldNumber, final MessageNano value)
Write an embedded message field, including tag, to the stream. |
| public void | |
| public void | |
| public void | |
| public void | |
| public void | |
| public void | |
| public void | |
| public void | |
| public void | |
| public void | writeSFixed32(final int fieldNumber, final int value)
Write an |
| public void | |
| public void | writeSFixed64(final int fieldNumber, final long value)
Write an |
| public void | |
| public void | writeSInt32(final int fieldNumber, final int value)
Write an |
| public void | |
| public void | writeSInt64(final int fieldNumber, final long value)
Write an |
| public void | |
| public void | writeString(final int fieldNumber, final String value)
Write a |
| public void | |
| public void | |
| public void | writeUInt32(final int fieldNumber, final int value)
Write a |
| public void | |
| public void | writeUInt64(final int fieldNumber, final long value)
Write a |
| public void |
| buffer | back to summary |
|---|---|
| private final ByteBuffer buffer | |
| LITTLE_ENDIAN_32_SIZE | back to summary |
|---|---|
| public static final int LITTLE_ENDIAN_32_SIZE | |
| LITTLE_ENDIAN_64_SIZE | back to summary |
|---|---|
| public static final int LITTLE_ENDIAN_64_SIZE | |
| MAX_UTF8_EXPANSION | back to summary |
|---|---|
| private static final int MAX_UTF8_EXPANSION | |
| CodedOutputByteBufferNano | back to summary |
|---|---|
| private CodedOutputByteBufferNano(final byte[] buffer, final int offset, final int length) | |
| CodedOutputByteBufferNano | back to summary |
|---|---|
| private CodedOutputByteBufferNano(final ByteBuffer buffer) | |
| checkNoSpaceLeft | back to summary |
|---|---|
| public void checkNoSpaceLeft() Verifies that | |
| computeBoolSize | back to summary |
|---|---|
| public static int computeBoolSize(final int fieldNumber, final boolean value) Compute the number of bytes that would be needed to encode a
| |
| computeBoolSizeNoTag | back to summary |
|---|---|
| public static int computeBoolSizeNoTag(final boolean value) Compute the number of bytes that would be needed to encode a
| |
| computeBytesSize | back to summary |
|---|---|
| public static int computeBytesSize(final int fieldNumber, final byte[] value) Compute the number of bytes that would be needed to encode a
| |
| computeBytesSizeNoTag | back to summary |
|---|---|
| public static int computeBytesSizeNoTag(final byte[] value) Compute the number of bytes that would be needed to encode a
| |
| computeDoubleSize | back to summary |
|---|---|
| public static int computeDoubleSize(final int fieldNumber, final double value) Compute the number of bytes that would be needed to encode a
| |
| computeDoubleSizeNoTag | back to summary |
|---|---|
| public static int computeDoubleSizeNoTag(final double value) Compute the number of bytes that would be needed to encode a
| |
| computeEnumSize | back to summary |
|---|---|
| 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. Caller is responsible for converting the enum value to its numeric value. | |
| computeEnumSizeNoTag | back to summary |
|---|---|
| public static int computeEnumSizeNoTag(final int value) Compute the number of bytes that would be needed to encode an enum field. Caller is responsible for converting the enum value to its numeric value. | |
| computeFieldSize | back to summary |
|---|---|
| pack-priv static int computeFieldSize(int number, int type, Object object) | |
| computeFixed32Size | back to summary |
|---|---|
| public static int computeFixed32Size(final int fieldNumber, final int value) Compute the number of bytes that would be needed to encode a
| |
| computeFixed32SizeNoTag | back to summary |
|---|---|
| public static int computeFixed32SizeNoTag(final int value) Compute the number of bytes that would be needed to encode a
| |
| computeFixed64Size | back to summary |
|---|---|
| public static int computeFixed64Size(final int fieldNumber, final long value) Compute the number of bytes that would be needed to encode a
| |
| computeFixed64SizeNoTag | back to summary |
|---|---|
| public static int computeFixed64SizeNoTag(final long value) Compute the number of bytes that would be needed to encode a
| |
| computeFloatSize | back to summary |
|---|---|
| public static int computeFloatSize(final int fieldNumber, final float value) Compute the number of bytes that would be needed to encode a
| |
| computeFloatSizeNoTag | back to summary |
|---|---|
| public static int computeFloatSizeNoTag(final float value) Compute the number of bytes that would be needed to encode a
| |
| computeGroupSize | back to summary |
|---|---|
| public static int computeGroupSize(final int fieldNumber, final MessageNano value) Compute the number of bytes that would be needed to encode a
| |
| computeGroupSizeNoTag | back to summary |
|---|---|
| public static int computeGroupSizeNoTag(final MessageNano value) Compute the number of bytes that would be needed to encode a
| |
| computeInt32Size | back to summary |
|---|---|
| public static int computeInt32Size(final int fieldNumber, final int value) Compute the number of bytes that would be needed to encode an
| |
| computeInt32SizeNoTag | back to summary |
|---|---|
| public static int computeInt32SizeNoTag(final int value) Compute the number of bytes that would be needed to encode an
| |
| computeInt64Size | back to summary |
|---|---|
| public static int computeInt64Size(final int fieldNumber, final long value) Compute the number of bytes that would be needed to encode an
| |
| computeInt64SizeNoTag | back to summary |
|---|---|
| public static int computeInt64SizeNoTag(final long value) Compute the number of bytes that would be needed to encode an
| |
| computeMessageSize | back to summary |
|---|---|
| public static int computeMessageSize(final int fieldNumber, final MessageNano value) Compute the number of bytes that would be needed to encode an embedded message field, including tag. | |
| computeMessageSizeNoTag | back to summary |
|---|---|
| public static int computeMessageSizeNoTag(final MessageNano value) Compute the number of bytes that would be needed to encode an embedded message field. | |
| computeRawVarint32Size | back to summary |
|---|---|
| public static int computeRawVarint32Size(final int value) Compute the number of bytes that would be needed to encode a varint.
| |
| computeRawVarint64Size | back to summary |
|---|---|
| public static int computeRawVarint64Size(final long value) Compute the number of bytes that would be needed to encode a varint. | |
| computeSFixed32Size | back to summary |
|---|---|
| public static int computeSFixed32Size(final int fieldNumber, final int value) Compute the number of bytes that would be needed to encode an
| |
| computeSFixed32SizeNoTag | back to summary |
|---|---|
| public static int computeSFixed32SizeNoTag(final int value) Compute the number of bytes that would be needed to encode an
| |
| computeSFixed64Size | back to summary |
|---|---|
| public static int computeSFixed64Size(final int fieldNumber, final long value) Compute the number of bytes that would be needed to encode an
| |
| computeSFixed64SizeNoTag | back to summary |
|---|---|
| public static int computeSFixed64SizeNoTag(final long value) Compute the number of bytes that would be needed to encode an
| |
| computeSInt32Size | back to summary |
|---|---|
| public static int computeSInt32Size(final int fieldNumber, final int value) Compute the number of bytes that would be needed to encode an
| |
| computeSInt32SizeNoTag | back to summary |
|---|---|
| public static int computeSInt32SizeNoTag(final int value) Compute the number of bytes that would be needed to encode an
| |
| computeSInt64Size | back to summary |
|---|---|
| public static int computeSInt64Size(final int fieldNumber, final long value) Compute the number of bytes that would be needed to encode an
| |
| computeSInt64SizeNoTag | back to summary |
|---|---|
| public static int computeSInt64SizeNoTag(final long value) Compute the number of bytes that would be needed to encode an
| |
| computeStringSize | back to summary |
|---|---|
| public static int computeStringSize(final int fieldNumber, final String value) Compute the number of bytes that would be needed to encode a
| |
| computeStringSizeNoTag | back to summary |
|---|---|
| public static int computeStringSizeNoTag(final String value) Compute the number of bytes that would be needed to encode a
| |
| computeTagSize | back to summary |
|---|---|
| public static int computeTagSize(final int fieldNumber) Compute the number of bytes that would be needed to encode a tag. | |
| computeUInt32Size | back to summary |
|---|---|
| public static int computeUInt32Size(final int fieldNumber, final int value) Compute the number of bytes that would be needed to encode a
| |
| computeUInt32SizeNoTag | back to summary |
|---|---|
| public static int computeUInt32SizeNoTag(final int value) Compute the number of bytes that would be needed to encode a
| |
| computeUInt64Size | back to summary |
|---|---|
| public static int computeUInt64Size(final int fieldNumber, final long value) Compute the number of bytes that would be needed to encode a
| |
| computeUInt64SizeNoTag | back to summary |
|---|---|
| public static int computeUInt64SizeNoTag(final long value) Compute the number of bytes that would be needed to encode a
| |
| encode | back to summary |
|---|---|
| private static void encode(CharSequence sequence, ByteBuffer byteBuffer) Encodes To ensure sufficient space in the output buffer, either call
| |
| encode | back to summary |
|---|---|
| private static int encode(CharSequence sequence, byte[] bytes, int offset, int length) | |
| encodeDirect | back to summary |
|---|---|
| private static void encodeDirect(CharSequence sequence, ByteBuffer byteBuffer) | |
| encodedLength | back to summary |
|---|---|
| private static int encodedLength(CharSequence sequence) Returns the number of bytes in the UTF-8-encoded form of
| |
| encodedLengthGeneral | back to summary |
|---|---|
| private static int encodedLengthGeneral(CharSequence sequence, int start) | |
| encodeZigZag32 | back to summary |
|---|---|
| public static int encodeZigZag32(final int n) Encode a ZigZag-encoded 32-bit value. ZigZag encodes signed integers into values that can be efficiently encoded with varint. (Otherwise, negative values must be sign-extended to 64 bits to be varint encoded, thus always taking 10 bytes on the wire.)
| |
| encodeZigZag64 | back to summary |
|---|---|
| public static long encodeZigZag64(final long n) Encode a ZigZag-encoded 64-bit value. ZigZag encodes signed integers into values that can be efficiently encoded with varint. (Otherwise, negative values must be sign-extended to 64 bits to be varint encoded, thus always taking 10 bytes on the wire.)
| |
| newInstance | back to summary |
|---|---|
| public static CodedOutputByteBufferNano newInstance(final byte[] flatArray) Create a new | |
| newInstance | back to summary |
|---|---|
| public static CodedOutputByteBufferNano newInstance(final byte[] flatArray, final int offset, final int length) Create a new | |
| position | back to summary |
|---|---|
| public int position() Returns the position within the internal buffer. | |
| reset | back to summary |
|---|---|
| public void reset() Resets the position within the internal buffer to zero. | |
| spaceLeft | back to summary |
|---|---|
| public int spaceLeft() If writing to a flat array, return the space left in the array.
Otherwise, throws | |
| writeBool | back to summary |
|---|---|
| public void writeBool(final int fieldNumber, final boolean value) throws IOException Write a | |
| writeBoolNoTag | back to summary |
|---|---|
| public void writeBoolNoTag(final boolean value) throws IOException Write a | |
| writeBytes | back to summary |
|---|---|
| public void writeBytes(final int fieldNumber, final byte[] value) throws IOException Write a | |
| writeBytesNoTag | back to summary |
|---|---|
| public void writeBytesNoTag(final byte[] value) throws IOException Write a | |
| writeDouble | back to summary |
|---|---|
| public void writeDouble(final int fieldNumber, final double value) throws IOException Write a | |
| writeDoubleNoTag | back to summary |
|---|---|
| public void writeDoubleNoTag(final double value) throws IOException Write a | |
| writeEnum | back to summary |
|---|---|
| public void writeEnum(final int fieldNumber, final int value) throws IOException Write an enum field, including tag, to the stream. Caller is responsible for converting the enum value to its numeric value. | |
| writeEnumNoTag | back to summary |
|---|---|
| public void writeEnumNoTag(final int value) throws IOException Write an enum field to the stream. Caller is responsible for converting the enum value to its numeric value. | |
| writeField | back to summary |
|---|---|
| pack-priv void writeField(int number, int type, Object value) throws IOException | |
| writeFixed32 | back to summary |
|---|---|
| public void writeFixed32(final int fieldNumber, final int value) throws IOException Write a | |
| writeFixed32NoTag | back to summary |
|---|---|
| public void writeFixed32NoTag(final int value) throws IOException Write a | |
| writeFixed64 | back to summary |
|---|---|
| public void writeFixed64(final int fieldNumber, final long value) throws IOException Write a | |
| writeFixed64NoTag | back to summary |
|---|---|
| public void writeFixed64NoTag(final long value) throws IOException Write a | |
| writeFloat | back to summary |
|---|---|
| public void writeFloat(final int fieldNumber, final float value) throws IOException Write a | |
| writeFloatNoTag | back to summary |
|---|---|
| public void writeFloatNoTag(final float value) throws IOException Write a | |
| writeGroup | back to summary |
|---|---|
| public void writeGroup(final int fieldNumber, final MessageNano value) throws IOException Write a | |
| writeGroupNoTag | back to summary |
|---|---|
| public void writeGroupNoTag(final MessageNano value) throws IOException Write a | |
| writeInt32 | back to summary |
|---|---|
| public void writeInt32(final int fieldNumber, final int value) throws IOException Write an | |
| writeInt32NoTag | back to summary |
|---|---|
| public void writeInt32NoTag(final int value) throws IOException Write an | |
| writeInt64 | back to summary |
|---|---|
| public void writeInt64(final int fieldNumber, final long value) throws IOException Write an | |
| writeInt64NoTag | back to summary |
|---|---|
| public void writeInt64NoTag(final long value) throws IOException Write an | |
| writeMessage | back to summary |
|---|---|
| public void writeMessage(final int fieldNumber, final MessageNano value) throws IOException Write an embedded message field, including tag, to the stream. | |
| writeMessageNoTag | back to summary |
|---|---|
| public void writeMessageNoTag(final MessageNano value) throws IOException Write an embedded message field to the stream. | |
| writeRawByte | back to summary |
|---|---|
| public void writeRawByte(final byte value) throws IOException Write a single byte. | |
| writeRawByte | back to summary |
|---|---|
| public void writeRawByte(final int value) throws IOException Write a single byte, represented by an integer value. | |
| writeRawBytes | back to summary |
|---|---|
| public void writeRawBytes(final byte[] value) throws IOException Write an array of bytes. | |
| writeRawBytes | back to summary |
|---|---|
| public void writeRawBytes(final byte[] value, int offset, int length) throws IOException Write part of an array of bytes. | |
| writeRawLittleEndian32 | back to summary |
|---|---|
| public void writeRawLittleEndian32(final int value) throws IOException Write a little-endian 32-bit integer. | |
| writeRawLittleEndian64 | back to summary |
|---|---|
| public void writeRawLittleEndian64(final long value) throws IOException Write a little-endian 64-bit integer. | |
| writeRawVarint32 | back to summary |
|---|---|
| public void writeRawVarint32(int value) throws IOException Encode and write a varint. | |
| writeRawVarint64 | back to summary |
|---|---|
| public void writeRawVarint64(long value) throws IOException Encode and write a varint. | |
| writeSFixed32 | back to summary |
|---|---|
| public void writeSFixed32(final int fieldNumber, final int value) throws IOException Write an | |
| writeSFixed32NoTag | back to summary |
|---|---|
| public void writeSFixed32NoTag(final int value) throws IOException Write an | |
| writeSFixed64 | back to summary |
|---|---|
| public void writeSFixed64(final int fieldNumber, final long value) throws IOException Write an | |
| writeSFixed64NoTag | back to summary |
|---|---|
| public void writeSFixed64NoTag(final long value) throws IOException Write an | |
| writeSInt32 | back to summary |
|---|---|
| public void writeSInt32(final int fieldNumber, final int value) throws IOException Write an | |
| writeSInt32NoTag | back to summary |
|---|---|
| public void writeSInt32NoTag(final int value) throws IOException Write an | |
| writeSInt64 | back to summary |
|---|---|
| public void writeSInt64(final int fieldNumber, final long value) throws IOException Write an | |
| writeSInt64NoTag | back to summary |
|---|---|
| public void writeSInt64NoTag(final long value) throws IOException Write an | |
| writeString | back to summary |
|---|---|
| public void writeString(final int fieldNumber, final String value) throws IOException Write a | |
| writeStringNoTag | back to summary |
|---|---|
| public void writeStringNoTag(final String value) throws IOException Write a | |
| writeTag | back to summary |
|---|---|
| public void writeTag(final int fieldNumber, final int wireType) throws IOException Encode and write a tag. | |
| writeUInt32 | back to summary |
|---|---|
| public void writeUInt32(final int fieldNumber, final int value) throws IOException Write a | |
| writeUInt32NoTag | back to summary |
|---|---|
| public void writeUInt32NoTag(final int value) throws IOException Write a | |
| writeUInt64 | back to summary |
|---|---|
| public void writeUInt64(final int fieldNumber, final long value) throws IOException Write a | |
| writeUInt64NoTag | back to summary |
|---|---|
| public void writeUInt64NoTag(final long value) throws IOException Write a | |
| Modifier and Type | Field and Description |
|---|---|
| private static final long |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID | |
| OutOfSpaceException | back to summary |
|---|---|
| pack-priv OutOfSpaceException(int position, int limit) | |