|
@@ -72,13 +72,20 @@ public abstract class AbstractMessageLite implements MessageLite {
|
|
}
|
|
}
|
|
|
|
|
|
public void writeTo(final OutputStream output) throws IOException {
|
|
public void writeTo(final OutputStream output) throws IOException {
|
|
- final CodedOutputStream codedOutput = CodedOutputStream.newInstance(output);
|
|
|
|
|
|
+ final int bufferSize =
|
|
|
|
+ CodedOutputStream.computePreferredBufferSize(getSerializedSize());
|
|
|
|
+ final CodedOutputStream codedOutput =
|
|
|
|
+ CodedOutputStream.newInstance(output, bufferSize);
|
|
writeTo(codedOutput);
|
|
writeTo(codedOutput);
|
|
codedOutput.flush();
|
|
codedOutput.flush();
|
|
}
|
|
}
|
|
|
|
|
|
public void writeDelimitedTo(final OutputStream output) throws IOException {
|
|
public void writeDelimitedTo(final OutputStream output) throws IOException {
|
|
- final CodedOutputStream codedOutput = CodedOutputStream.newInstance(output);
|
|
|
|
|
|
+ final int serialized = getSerializedSize();
|
|
|
|
+ final int bufferSize = CodedOutputStream.computePreferredBufferSize(
|
|
|
|
+ CodedOutputStream.computeRawVarint32Size(serialized) + serialized);
|
|
|
|
+ final CodedOutputStream codedOutput =
|
|
|
|
+ CodedOutputStream.newInstance(output, bufferSize);
|
|
codedOutput.writeRawVarint32(getSerializedSize());
|
|
codedOutput.writeRawVarint32(getSerializedSize());
|
|
writeTo(codedOutput);
|
|
writeTo(codedOutput);
|
|
codedOutput.flush();
|
|
codedOutput.flush();
|