| Index: third_party/protobuf/java/src/main/java/com/google/protobuf/CodedOutputStream.java
|
| ===================================================================
|
| --- third_party/protobuf/java/src/main/java/com/google/protobuf/CodedOutputStream.java (revision 216642)
|
| +++ third_party/protobuf/java/src/main/java/com/google/protobuf/CodedOutputStream.java (working copy)
|
| @@ -30,10 +30,10 @@
|
|
|
| package com.google.protobuf;
|
|
|
| +import java.io.IOException;
|
| +import java.io.InputStream;
|
| import java.io.OutputStream;
|
| -import java.io.IOException;
|
| import java.io.UnsupportedEncodingException;
|
| -import java.io.InputStream;
|
|
|
| /**
|
| * Encodes and writes protocol message fields.
|
| @@ -540,6 +540,15 @@
|
| }
|
|
|
| /**
|
| + * Compute the number of bytes that would be needed to encode an
|
| + * embedded message in lazy field, including tag.
|
| + */
|
| + public static int computeLazyFieldSize(final int fieldNumber,
|
| + final LazyField value) {
|
| + return computeTagSize(fieldNumber) + computeLazyFieldSizeNoTag(value);
|
| + }
|
| +
|
| + /**
|
| * Compute the number of bytes that would be needed to encode a
|
| * {@code uint32} field, including tag.
|
| */
|
| @@ -614,6 +623,18 @@
|
| computeBytesSize(WireFormat.MESSAGE_SET_MESSAGE, value);
|
| }
|
|
|
| + /**
|
| + * Compute the number of bytes that would be needed to encode an
|
| + * lazily parsed MessageSet extension field to the stream. For
|
| + * historical reasons, the wire format differs from normal fields.
|
| + */
|
| + public static int computeLazyFieldMessageSetExtensionSize(
|
| + final int fieldNumber, final LazyField value) {
|
| + return computeTagSize(WireFormat.MESSAGE_SET_ITEM) * 2 +
|
| + computeUInt32Size(WireFormat.MESSAGE_SET_TYPE_ID, fieldNumber) +
|
| + computeLazyFieldSize(WireFormat.MESSAGE_SET_MESSAGE, value);
|
| + }
|
| +
|
| // -----------------------------------------------------------------
|
|
|
| /**
|
| @@ -730,6 +751,15 @@
|
| }
|
|
|
| /**
|
| + * Compute the number of bytes that would be needed to encode an embedded
|
| + * message stored in lazy field.
|
| + */
|
| + public static int computeLazyFieldSizeNoTag(final LazyField value) {
|
| + final int size = value.getSerializedSize();
|
| + return computeRawVarint32Size(size) + size;
|
| + }
|
| +
|
| + /**
|
| * Compute the number of bytes that would be needed to encode a
|
| * {@code bytes} field.
|
| */
|
|
|