webkit  2cdf99a9e3038c7e01b3c37e8ad903ecbe5eecf1
https://github.com/WebKit/webkit
Classes | Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
com.google.protobuf.CodedOutputStream Class Referenceabstract
Inheritance diagram for com.google.protobuf.CodedOutputStream:
com.google.protobuf.ByteOutput

Classes

class  OutOfSpaceException
 

Public Member Functions

abstract void writeTag (int fieldNumber, int wireType) throws IOException
 
abstract void writeInt32 (int fieldNumber, int value) throws IOException
 
abstract void writeUInt32 (int fieldNumber, int value) throws IOException
 
final void writeSInt32 (final int fieldNumber, final int value) throws IOException
 
abstract void writeFixed32 (int fieldNumber, int value) throws IOException
 
final void writeSFixed32 (final int fieldNumber, final int value) throws IOException
 
final void writeInt64 (final int fieldNumber, final long value) throws IOException
 
abstract void writeUInt64 (int fieldNumber, long value) throws IOException
 
final void writeSInt64 (final int fieldNumber, final long value) throws IOException
 
abstract void writeFixed64 (int fieldNumber, long value) throws IOException
 
final void writeSFixed64 (final int fieldNumber, final long value) throws IOException
 
final void writeFloat (final int fieldNumber, final float value) throws IOException
 
final void writeDouble (final int fieldNumber, final double value) throws IOException
 
abstract void writeBool (int fieldNumber, boolean value) throws IOException
 
final void writeEnum (final int fieldNumber, final int value) throws IOException
 
abstract void writeString (int fieldNumber, String value) throws IOException
 
abstract void writeBytes (int fieldNumber, ByteString value) throws IOException
 
abstract void writeByteArray (int fieldNumber, byte[] value) throws IOException
 
abstract void writeByteArray (int fieldNumber, byte[] value, int offset, int length) throws IOException
 
abstract void writeByteBuffer (int fieldNumber, ByteBuffer value) throws IOException
 
final void writeRawByte (final byte value) throws IOException
 
final void writeRawByte (final int value) throws IOException
 
final void writeRawBytes (final byte[] value) throws IOException
 
final void writeRawBytes (final byte[] value, int offset, int length) throws IOException
 
final void writeRawBytes (final ByteString value) throws IOException
 
abstract void writeRawBytes (final ByteBuffer value) throws IOException
 
abstract void writeMessage (final int fieldNumber, final MessageLite value) throws IOException
 
abstract void writeMessageSetExtension (final int fieldNumber, final MessageLite value) throws IOException
 
abstract void writeRawMessageSetExtension (final int fieldNumber, final ByteString value) throws IOException
 
abstract void writeInt32NoTag (final int value) throws IOException
 
abstract void writeUInt32NoTag (int value) throws IOException
 
final void writeSInt32NoTag (final int value) throws IOException
 
abstract void writeFixed32NoTag (int value) throws IOException
 
final void writeSFixed32NoTag (final int value) throws IOException
 
final void writeInt64NoTag (final long value) throws IOException
 
abstract void writeUInt64NoTag (long value) throws IOException
 
final void writeSInt64NoTag (final long value) throws IOException
 
abstract void writeFixed64NoTag (long value) throws IOException
 
final void writeSFixed64NoTag (final long value) throws IOException
 
final void writeFloatNoTag (final float value) throws IOException
 
final void writeDoubleNoTag (final double value) throws IOException
 
final void writeBoolNoTag (final boolean value) throws IOException
 
final void writeEnumNoTag (final int value) throws IOException
 
abstract void writeStringNoTag (String value) throws IOException
 
abstract void writeBytesNoTag (final ByteString value) throws IOException
 
final void writeByteArrayNoTag (final byte[] value) throws IOException
 
abstract void writeMessageNoTag (final MessageLite value) throws IOException
 
abstract void write (byte value) throws IOException
 
abstract void write (byte[] value, int offset, int length) throws IOException
 
abstract void writeLazy (byte[] value, int offset, int length) throws IOException
 
abstract void write (ByteBuffer value) throws IOException
 
abstract void writeLazy (ByteBuffer value) throws IOException
 
abstract void flush () throws IOException
 
abstract int spaceLeft ()
 
final void checkNoSpaceLeft ()
 
abstract int getTotalBytesWritten ()
 
final void writeGroup (final int fieldNumber, final MessageLite value) throws IOException
 
final void writeGroupNoTag (final MessageLite value) throws IOException
 
final void writeRawVarint32 (int value) throws IOException
 
final void writeRawVarint64 (long value) throws IOException
 
final void writeRawLittleEndian32 (final int value) throws IOException
 
final void writeRawLittleEndian64 (final long value) throws IOException
 
- Public Member Functions inherited from com.google.protobuf.ByteOutput
abstract void write (byte value) throws IOException
 
abstract void write (byte[] value, int offset, int length) throws IOException
 
abstract void writeLazy (byte[] value, int offset, int length) throws IOException
 
abstract void write (ByteBuffer value) throws IOException
 
abstract void writeLazy (ByteBuffer value) throws IOException
 

Static Public Member Functions

static CodedOutputStream newInstance (final OutputStream output)
 
static CodedOutputStream newInstance (final OutputStream output, final int bufferSize)
 
static CodedOutputStream newInstance (final byte[] flatArray)
 
static CodedOutputStream newInstance (final byte[] flatArray, final int offset, final int length)
 
static CodedOutputStream newInstance (ByteBuffer byteBuffer)
 
static CodedOutputStream newInstance (ByteBuffer byteBuffer, @SuppressWarnings("unused") int unused)
 
static int computeInt32Size (final int fieldNumber, final int value)
 
static int computeUInt32Size (final int fieldNumber, final int value)
 
static int computeSInt32Size (final int fieldNumber, final int value)
 
static int computeFixed32Size (final int fieldNumber, final int value)
 
static int computeSFixed32Size (final int fieldNumber, final int value)
 
static int computeInt64Size (final int fieldNumber, final long value)
 
static int computeUInt64Size (final int fieldNumber, final long value)
 
static int computeSInt64Size (final int fieldNumber, final long value)
 
static int computeFixed64Size (final int fieldNumber, final long value)
 
static int computeSFixed64Size (final int fieldNumber, final long value)
 
static int computeFloatSize (final int fieldNumber, final float value)
 
static int computeDoubleSize (final int fieldNumber, final double value)
 
static int computeBoolSize (final int fieldNumber, final boolean value)
 
static int computeEnumSize (final int fieldNumber, final int value)
 
static int computeStringSize (final int fieldNumber, final String value)
 
static int computeBytesSize (final int fieldNumber, final ByteString value)
 
static int computeByteArraySize (final int fieldNumber, final byte[] value)
 
static int computeByteBufferSize (final int fieldNumber, final ByteBuffer value)
 
static int computeLazyFieldSize (final int fieldNumber, final LazyFieldLite value)
 
static int computeMessageSize (final int fieldNumber, final MessageLite value)
 
static int computeMessageSetExtensionSize (final int fieldNumber, final MessageLite value)
 
static int computeRawMessageSetExtensionSize (final int fieldNumber, final ByteString value)
 
static int computeLazyFieldMessageSetExtensionSize (final int fieldNumber, final LazyFieldLite value)
 
static int computeTagSize (final int fieldNumber)
 
static int computeInt32SizeNoTag (final int value)
 
static int computeUInt32SizeNoTag (final int value)
 
static int computeSInt32SizeNoTag (final int value)
 
static int computeFixed32SizeNoTag (@SuppressWarnings("unused") final int unused)
 
static int computeSFixed32SizeNoTag (@SuppressWarnings("unused") final int unused)
 
static int computeInt64SizeNoTag (final long value)
 
static int computeUInt64SizeNoTag (long value)
 
static int computeSInt64SizeNoTag (final long value)
 
static int computeFixed64SizeNoTag (@SuppressWarnings("unused") final long unused)
 
static int computeSFixed64SizeNoTag (@SuppressWarnings("unused") final long unused)
 
static int computeFloatSizeNoTag (@SuppressWarnings("unused") final float unused)
 
static int computeDoubleSizeNoTag (@SuppressWarnings("unused") final double unused)
 
static int computeBoolSizeNoTag (@SuppressWarnings("unused") final boolean unused)
 
static int computeEnumSizeNoTag (final int value)
 
static int computeStringSizeNoTag (final String value)
 
static int computeLazyFieldSizeNoTag (final LazyFieldLite value)
 
static int computeBytesSizeNoTag (final ByteString value)
 
static int computeByteArraySizeNoTag (final byte[] value)
 
static int computeByteBufferSizeNoTag (final ByteBuffer value)
 
static int computeMessageSizeNoTag (final MessageLite value)
 
static int encodeZigZag32 (final int n)
 
static long encodeZigZag64 (final long n)
 
static int computeGroupSize (final int fieldNumber, final MessageLite value)
 
static int computeGroupSizeNoTag (final MessageLite value)
 
static int computeRawVarint32Size (final int value)
 
static int computeRawVarint64Size (long value)
 

Static Public Attributes

static final int LITTLE_ENDIAN_32_SIZE = FIXED_32_SIZE
 
static final int DEFAULT_BUFFER_SIZE = 4096
 

Detailed Description

Encodes and writes protocol message fields.

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.

Member Function Documentation

◆ checkNoSpaceLeft()

final void com.google.protobuf.CodedOutputStream.checkNoSpaceLeft ( )
inline

Verifies that spaceLeft() returns zero. It's common to create a byte array that is exactly big enough to hold a message, then write to it with a

CodedOutputStream

. Calling

after writing verifies that the message was actually as big as expected, which can help catch bugs.

◆ computeBoolSize()

static int com.google.protobuf.CodedOutputStream.computeBoolSize ( final int  fieldNumber,
final boolean  value 
)
inlinestatic

Compute the number of bytes that would be needed to encode a

bool

field, including tag.

◆ computeBoolSizeNoTag()

static int com.google.protobuf.CodedOutputStream.computeBoolSizeNoTag ( @SuppressWarnings("unused") final boolean  unused)
inlinestatic

Compute the number of bytes that would be needed to encode a

bool

field.

◆ computeByteArraySize()

static int com.google.protobuf.CodedOutputStream.computeByteArraySize ( final int  fieldNumber,
final byte []  value 
)
inlinestatic

Compute the number of bytes that would be needed to encode a

field, including tag.

◆ computeByteArraySizeNoTag()

static int com.google.protobuf.CodedOutputStream.computeByteArraySizeNoTag ( final byte []  value)
inlinestatic

Compute the number of bytes that would be needed to encode a

field.

◆ computeByteBufferSize()

static int com.google.protobuf.CodedOutputStream.computeByteBufferSize ( final int  fieldNumber,
final ByteBuffer  value 
)
inlinestatic

Compute the number of bytes that would be needed to encode a

field, including tag.

◆ computeByteBufferSizeNoTag()

static int com.google.protobuf.CodedOutputStream.computeByteBufferSizeNoTag ( final ByteBuffer  value)
inlinestatic

Compute the number of bytes that would be needed to encode a

field.

◆ computeBytesSize()

static int com.google.protobuf.CodedOutputStream.computeBytesSize ( final int  fieldNumber,
final ByteString  value 
)
inlinestatic

Compute the number of bytes that would be needed to encode a

field, including tag.

◆ computeBytesSizeNoTag()

static int com.google.protobuf.CodedOutputStream.computeBytesSizeNoTag ( final ByteString  value)
inlinestatic

Compute the number of bytes that would be needed to encode a

field.

◆ computeDoubleSize()

static int com.google.protobuf.CodedOutputStream.computeDoubleSize ( final int  fieldNumber,
final double  value 
)
inlinestatic

Compute the number of bytes that would be needed to encode a

double

field, including tag.

◆ computeDoubleSizeNoTag()

static int com.google.protobuf.CodedOutputStream.computeDoubleSizeNoTag ( @SuppressWarnings("unused") final double  unused)
inlinestatic

Compute the number of bytes that would be needed to encode a

double

field, including tag.

◆ computeEnumSize()

static int com.google.protobuf.CodedOutputStream.computeEnumSize ( final int  fieldNumber,
final int  value 
)
inlinestatic

Compute the number of bytes that would be needed to encode an enum field, including tag. The provided value is the numeric value used to represent the enum value on the wire (not the enum ordinal value).

◆ computeEnumSizeNoTag()

static int com.google.protobuf.CodedOutputStream.computeEnumSizeNoTag ( final int  value)
inlinestatic

Compute the number of bytes that would be needed to encode an enum field. The provided value is the numeric value used to represent the enum value on the wire (not the enum ordinal value).

◆ computeFixed32Size()

static int com.google.protobuf.CodedOutputStream.computeFixed32Size ( final int  fieldNumber,
final int  value 
)
inlinestatic

Compute the number of bytes that would be needed to encode a

fixed32

field, including tag.

◆ computeFixed32SizeNoTag()

static int com.google.protobuf.CodedOutputStream.computeFixed32SizeNoTag ( @SuppressWarnings("unused") final int  unused)
inlinestatic

Compute the number of bytes that would be needed to encode a

fixed32

field.

◆ computeFixed64Size()

static int com.google.protobuf.CodedOutputStream.computeFixed64Size ( final int  fieldNumber,
final long  value 
)
inlinestatic

Compute the number of bytes that would be needed to encode a

fixed64

field, including tag.

◆ computeFixed64SizeNoTag()

static int com.google.protobuf.CodedOutputStream.computeFixed64SizeNoTag ( @SuppressWarnings("unused") final long  unused)
inlinestatic

Compute the number of bytes that would be needed to encode a

fixed64

field.

◆ computeFloatSize()

static int com.google.protobuf.CodedOutputStream.computeFloatSize ( final int  fieldNumber,
final float  value 
)
inlinestatic

Compute the number of bytes that would be needed to encode a

float

field, including tag.

◆ computeFloatSizeNoTag()

static int com.google.protobuf.CodedOutputStream.computeFloatSizeNoTag ( @SuppressWarnings("unused") final float  unused)
inlinestatic

Compute the number of bytes that would be needed to encode a

float

field, including tag.

◆ computeGroupSize()

static int com.google.protobuf.CodedOutputStream.computeGroupSize ( final int  fieldNumber,
final MessageLite  value 
)
inlinestatic

Compute the number of bytes that would be needed to encode a

field, including tag.

Deprecated:
groups are deprecated.

◆ computeGroupSizeNoTag()

static int com.google.protobuf.CodedOutputStream.computeGroupSizeNoTag ( final MessageLite  value)
inlinestatic

Compute the number of bytes that would be needed to encode a

field.

◆ computeInt32Size()

static int com.google.protobuf.CodedOutputStream.computeInt32Size ( final int  fieldNumber,
final int  value 
)
inlinestatic

Compute the number of bytes that would be needed to encode an

field, including tag.

◆ computeInt32SizeNoTag()

static int com.google.protobuf.CodedOutputStream.computeInt32SizeNoTag ( final int  value)
inlinestatic

Compute the number of bytes that would be needed to encode an

field, including tag.

◆ computeInt64Size()

static int com.google.protobuf.CodedOutputStream.computeInt64Size ( final int  fieldNumber,
final long  value 
)
inlinestatic

Compute the number of bytes that would be needed to encode an

field, including tag.

◆ computeInt64SizeNoTag()

static int com.google.protobuf.CodedOutputStream.computeInt64SizeNoTag ( final long  value)
inlinestatic

Compute the number of bytes that would be needed to encode an

field, including tag.

◆ computeLazyFieldMessageSetExtensionSize()

static int com.google.protobuf.CodedOutputStream.computeLazyFieldMessageSetExtensionSize ( final int  fieldNumber,
final LazyFieldLite  value 
)
inlinestatic

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.

◆ computeLazyFieldSize()

static int com.google.protobuf.CodedOutputStream.computeLazyFieldSize ( final int  fieldNumber,
final LazyFieldLite  value 
)
inlinestatic

Compute the number of bytes that would be needed to encode an embedded message in lazy field, including tag.

◆ computeLazyFieldSizeNoTag()

static int com.google.protobuf.CodedOutputStream.computeLazyFieldSizeNoTag ( final LazyFieldLite  value)
inlinestatic

Compute the number of bytes that would be needed to encode an embedded message stored in lazy field.

◆ computeMessageSetExtensionSize()

static int com.google.protobuf.CodedOutputStream.computeMessageSetExtensionSize ( final int  fieldNumber,
final MessageLite  value 
)
inlinestatic

Compute the number of bytes that would be needed to encode a MessageSet extension to the stream. For historical reasons, the wire format differs from normal fields.

◆ computeMessageSize()

static int com.google.protobuf.CodedOutputStream.computeMessageSize ( final int  fieldNumber,
final MessageLite  value 
)
inlinestatic

Compute the number of bytes that would be needed to encode an embedded message field, including tag.

◆ computeMessageSizeNoTag()

static int com.google.protobuf.CodedOutputStream.computeMessageSizeNoTag ( final MessageLite  value)
inlinestatic

Compute the number of bytes that would be needed to encode an embedded message field.

◆ computeRawMessageSetExtensionSize()

static int com.google.protobuf.CodedOutputStream.computeRawMessageSetExtensionSize ( final int  fieldNumber,
final ByteString  value 
)
inlinestatic

Compute the number of bytes that would be needed to encode an unparsed MessageSet extension field to the stream. For historical reasons, the wire format differs from normal fields.

◆ computeRawVarint32Size()

static int com.google.protobuf.CodedOutputStream.computeRawVarint32Size ( final int  value)
inlinestatic

Compute the number of bytes that would be needed to encode a varint.

is treated as unsigned, so it won't be sign-extended if negative.

Deprecated:
use computeUInt32SizeNoTag(int) instead.

◆ computeRawVarint64Size()

static int com.google.protobuf.CodedOutputStream.computeRawVarint64Size ( long  value)
inlinestatic

Compute the number of bytes that would be needed to encode a varint.

Deprecated:
use computeUInt64SizeNoTag(long) instead.

◆ computeSFixed32Size()

static int com.google.protobuf.CodedOutputStream.computeSFixed32Size ( final int  fieldNumber,
final int  value 
)
inlinestatic

Compute the number of bytes that would be needed to encode an

sfixed32

field, including tag.

◆ computeSFixed32SizeNoTag()

static int com.google.protobuf.CodedOutputStream.computeSFixed32SizeNoTag ( @SuppressWarnings("unused") final int  unused)
inlinestatic

Compute the number of bytes that would be needed to encode an

sfixed32

field.

◆ computeSFixed64Size()

static int com.google.protobuf.CodedOutputStream.computeSFixed64Size ( final int  fieldNumber,
final long  value 
)
inlinestatic

Compute the number of bytes that would be needed to encode an

sfixed64

field, including tag.

◆ computeSFixed64SizeNoTag()

static int com.google.protobuf.CodedOutputStream.computeSFixed64SizeNoTag ( @SuppressWarnings("unused") final long  unused)
inlinestatic

Compute the number of bytes that would be needed to encode an

sfixed64

field.

◆ computeSInt32Size()

static int com.google.protobuf.CodedOutputStream.computeSInt32Size ( final int  fieldNumber,
final int  value 
)
inlinestatic

Compute the number of bytes that would be needed to encode an

sint32

field, including tag.

◆ computeSInt32SizeNoTag()

static int com.google.protobuf.CodedOutputStream.computeSInt32SizeNoTag ( final int  value)
inlinestatic

Compute the number of bytes that would be needed to encode an

sint32

field.

◆ computeSInt64Size()

static int com.google.protobuf.CodedOutputStream.computeSInt64Size ( final int  fieldNumber,
final long  value 
)
inlinestatic

Compute the number of bytes that would be needed to encode an

sint64

field, including tag.

◆ computeSInt64SizeNoTag()

static int com.google.protobuf.CodedOutputStream.computeSInt64SizeNoTag ( final long  value)
inlinestatic

Compute the number of bytes that would be needed to encode an

sint64

field.

◆ computeStringSize()

static int com.google.protobuf.CodedOutputStream.computeStringSize ( final int  fieldNumber,
final String  value 
)
inlinestatic

Compute the number of bytes that would be needed to encode a

string

field, including tag.

◆ computeStringSizeNoTag()

static int com.google.protobuf.CodedOutputStream.computeStringSizeNoTag ( final String  value)
inlinestatic

Compute the number of bytes that would be needed to encode a

string

field.

◆ computeTagSize()

static int com.google.protobuf.CodedOutputStream.computeTagSize ( final int  fieldNumber)
inlinestatic

Compute the number of bytes that would be needed to encode a tag.

◆ computeUInt32Size()

static int com.google.protobuf.CodedOutputStream.computeUInt32Size ( final int  fieldNumber,
final int  value 
)
inlinestatic

Compute the number of bytes that would be needed to encode a

field, including tag.

◆ computeUInt32SizeNoTag()

static int com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag ( final int  value)
inlinestatic

Compute the number of bytes that would be needed to encode a

field.

◆ computeUInt64Size()

static int com.google.protobuf.CodedOutputStream.computeUInt64Size ( final int  fieldNumber,
final long  value 
)
inlinestatic

Compute the number of bytes that would be needed to encode a

field, including tag.

◆ computeUInt64SizeNoTag()

static int com.google.protobuf.CodedOutputStream.computeUInt64SizeNoTag ( long  value)
inlinestatic

Compute the number of bytes that would be needed to encode a

field, including tag.

◆ encodeZigZag32()

static int com.google.protobuf.CodedOutputStream.encodeZigZag32 ( final int  n)
inlinestatic

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.)

Parameters
nA signed 32-bit integer.
Returns
An unsigned 32-bit integer, stored in a signed int because Java has no explicit unsigned support.

◆ encodeZigZag64()

static long com.google.protobuf.CodedOutputStream.encodeZigZag64 ( final long  n)
inlinestatic

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.)

Parameters
nA signed 64-bit integer.
Returns
An unsigned 64-bit integer, stored in a signed int because Java has no explicit unsigned support.

◆ flush()

abstract void com.google.protobuf.CodedOutputStream.flush ( ) throws IOException
abstract

Flushes the stream and forces any buffered bytes to be written. This does not flush the underlying OutputStream.

◆ getTotalBytesWritten()

abstract int com.google.protobuf.CodedOutputStream.getTotalBytesWritten ( )
abstract

Get the total number of bytes successfully written to this stream. The returned value is not guaranteed to be accurate if exceptions have been found in the middle of writing.

◆ newInstance() [1/6]

static CodedOutputStream com.google.protobuf.CodedOutputStream.newInstance ( final OutputStream  output)
inlinestatic

Create a new

CodedOutputStream

wrapping the given

OutputStream

.

NOTE: The provided OutputStream MUST NOT retain access or modify the provided byte arrays. Doing so may result in corrupted data, which would be difficult to debug.

◆ newInstance() [2/6]

static CodedOutputStream com.google.protobuf.CodedOutputStream.newInstance ( final OutputStream  output,
final int  bufferSize 
)
inlinestatic

Create a new

CodedOutputStream

wrapping the given

OutputStream

with a given buffer size.

NOTE: The provided OutputStream MUST NOT retain access or modify the provided byte arrays. Doing so may result in corrupted data, which would be difficult to debug.

◆ newInstance() [3/6]

static CodedOutputStream com.google.protobuf.CodedOutputStream.newInstance ( final byte []  flatArray)
inlinestatic

Create a new

CodedOutputStream

that writes directly to the given byte array. If more bytes are written than fit in the array, OutOfSpaceException will be thrown. Writing directly to a flat array is faster than writing to an

OutputStream

. See also ByteString#newCodedBuilder.

◆ newInstance() [4/6]

static CodedOutputStream com.google.protobuf.CodedOutputStream.newInstance ( final byte []  flatArray,
final int  offset,
final int  length 
)
inlinestatic

Create a new

CodedOutputStream

that writes directly to the given byte array slice. If more bytes are written than fit in the slice, OutOfSpaceException will be thrown. Writing directly to a flat array is faster than writing to an

OutputStream

. See also ByteString#newCodedBuilder.

◆ newInstance() [5/6]

static CodedOutputStream com.google.protobuf.CodedOutputStream.newInstance ( ByteBuffer  byteBuffer)
inlinestatic

Create a new

CodedOutputStream

that writes to the given ByteBuffer.

◆ newInstance() [6/6]

static CodedOutputStream com.google.protobuf.CodedOutputStream.newInstance ( ByteBuffer  byteBuffer,
@SuppressWarnings("unused") int  unused 
)
inlinestatic

Create a new

CodedOutputStream

that writes to the given ByteBuffer.

Deprecated:
the size parameter is no longer used since use of an internal buffer is useless (and wasteful) when writing to a ByteBuffer. Use newInstance(ByteBuffer) instead.

◆ spaceLeft()

abstract int com.google.protobuf.CodedOutputStream.spaceLeft ( )
abstract

If writing to a flat array, return the space left in the array. Otherwise, throws

UnsupportedOperationException

.

◆ write() [1/3]

abstract void com.google.protobuf.CodedOutputStream.write ( byte  value) throws IOException
abstract

◆ write() [2/3]

abstract void com.google.protobuf.CodedOutputStream.write ( byte []  value,
int  offset,
int  length 
) throws IOException
abstract

◆ write() [3/3]

abstract void com.google.protobuf.CodedOutputStream.write ( ByteBuffer  value) throws IOException
abstract

◆ writeBool()

abstract void com.google.protobuf.CodedOutputStream.writeBool ( int  fieldNumber,
boolean  value 
) throws IOException
abstract

Write a

bool

field, including tag, to the stream.

◆ writeBoolNoTag()

final void com.google.protobuf.CodedOutputStream.writeBoolNoTag ( final boolean  value) throws IOException
inline

Write a

bool

field to the stream.

◆ writeByteArray() [1/2]

abstract void com.google.protobuf.CodedOutputStream.writeByteArray ( int  fieldNumber,
byte []  value 
) throws IOException
abstract

Write a

field, including tag, to the stream.

◆ writeByteArray() [2/2]

abstract void com.google.protobuf.CodedOutputStream.writeByteArray ( int  fieldNumber,
byte []  value,
int  offset,
int  length 
) throws IOException
abstract

Write a

field, including tag, to the stream.

◆ writeByteArrayNoTag()

final void com.google.protobuf.CodedOutputStream.writeByteArrayNoTag ( final byte []  value) throws IOException
inline

Write a

field to the stream.

◆ writeByteBuffer()

abstract void com.google.protobuf.CodedOutputStream.writeByteBuffer ( int  fieldNumber,
ByteBuffer  value 
) throws IOException
abstract

Write a

field, including tag, to the stream. This method will write all content of the ByteBuffer regardless of the current position and limit (i.e., the number of bytes to be written is value.capacity(), not value.remaining()). Furthermore, this method doesn't alter the state of the passed-in ByteBuffer. Its position, limit, mark, etc. will remain unchanged. If you only want to write the remaining bytes of a ByteBuffer, you can call

writeByteBuffer(fieldNumber, byteBuffer.slice())

.

◆ writeBytes()

abstract void com.google.protobuf.CodedOutputStream.writeBytes ( int  fieldNumber,
ByteString  value 
) throws IOException
abstract

Write a

field, including tag, to the stream.

◆ writeBytesNoTag()

abstract void com.google.protobuf.CodedOutputStream.writeBytesNoTag ( final ByteString  value) throws IOException
abstract

Write a

field to the stream.

◆ writeDouble()

final void com.google.protobuf.CodedOutputStream.writeDouble ( final int  fieldNumber,
final double  value 
) throws IOException
inline

Write a

double

field, including tag, to the stream.

◆ writeDoubleNoTag()

final void com.google.protobuf.CodedOutputStream.writeDoubleNoTag ( final double  value) throws IOException
inline

Write a

double

field to the stream.

◆ writeEnum()

final void com.google.protobuf.CodedOutputStream.writeEnum ( final int  fieldNumber,
final int  value 
) throws IOException
inline

Write an enum field, including tag, to the stream. The provided value is the numeric value used to represent the enum value on the wire (not the enum ordinal value).

◆ writeEnumNoTag()

final void com.google.protobuf.CodedOutputStream.writeEnumNoTag ( final int  value) throws IOException
inline

Write an enum field to the stream. The provided value is the numeric value used to represent the enum value on the wire (not the enum ordinal value).

◆ writeFixed32()

abstract void com.google.protobuf.CodedOutputStream.writeFixed32 ( int  fieldNumber,
int  value 
) throws IOException
abstract

Write a

fixed32

field, including tag, to the stream.

◆ writeFixed32NoTag()

abstract void com.google.protobuf.CodedOutputStream.writeFixed32NoTag ( int  value) throws IOException
abstract

Write a

fixed32

field to the stream.

◆ writeFixed64()

abstract void com.google.protobuf.CodedOutputStream.writeFixed64 ( int  fieldNumber,
long  value 
) throws IOException
abstract

Write a

fixed64

field, including tag, to the stream.

◆ writeFixed64NoTag()

abstract void com.google.protobuf.CodedOutputStream.writeFixed64NoTag ( long  value) throws IOException
abstract

Write a

fixed64

field to the stream.

◆ writeFloat()

final void com.google.protobuf.CodedOutputStream.writeFloat ( final int  fieldNumber,
final float  value 
) throws IOException
inline

Write a

float

field, including tag, to the stream.

◆ writeFloatNoTag()

final void com.google.protobuf.CodedOutputStream.writeFloatNoTag ( final float  value) throws IOException
inline

Write a

float

field to the stream.

◆ writeGroup()

final void com.google.protobuf.CodedOutputStream.writeGroup ( final int  fieldNumber,
final MessageLite  value 
) throws IOException
inline

Write a

field, including tag, to the stream.

Deprecated:
groups are deprecated.

◆ writeGroupNoTag()

final void com.google.protobuf.CodedOutputStream.writeGroupNoTag ( final MessageLite  value) throws IOException
inline

Write a

field to the stream.

Deprecated:
groups are deprecated.

◆ writeInt32()

abstract void com.google.protobuf.CodedOutputStream.writeInt32 ( int  fieldNumber,
int  value 
) throws IOException
abstract

Write an

field, including tag, to the stream.

◆ writeInt32NoTag()

abstract void com.google.protobuf.CodedOutputStream.writeInt32NoTag ( final int  value) throws IOException
abstract

Write an

field to the stream.

◆ writeInt64()

final void com.google.protobuf.CodedOutputStream.writeInt64 ( final int  fieldNumber,
final long  value 
) throws IOException
inline

Write an

field, including tag, to the stream.

◆ writeInt64NoTag()

final void com.google.protobuf.CodedOutputStream.writeInt64NoTag ( final long  value) throws IOException
inline

Write an

field to the stream.

◆ writeLazy() [1/2]

abstract void com.google.protobuf.CodedOutputStream.writeLazy ( byte []  value,
int  offset,
int  length 
) throws IOException
abstract

◆ writeLazy() [2/2]

abstract void com.google.protobuf.CodedOutputStream.writeLazy ( ByteBuffer  value) throws IOException
abstract

◆ writeMessage()

abstract void com.google.protobuf.CodedOutputStream.writeMessage ( final int  fieldNumber,
final MessageLite  value 
) throws IOException
abstract

Write an embedded message field, including tag, to the stream.

◆ writeMessageNoTag()

abstract void com.google.protobuf.CodedOutputStream.writeMessageNoTag ( final MessageLite  value) throws IOException
abstract

Write an embedded message field to the stream.

◆ writeMessageSetExtension()

abstract void com.google.protobuf.CodedOutputStream.writeMessageSetExtension ( final int  fieldNumber,
final MessageLite  value 
) throws IOException
abstract

Write a MessageSet extension field to the stream. For historical reasons, the wire format differs from normal fields.

◆ writeRawByte() [1/2]

final void com.google.protobuf.CodedOutputStream.writeRawByte ( final byte  value) throws IOException
inline

Write a single byte.

◆ writeRawByte() [2/2]

final void com.google.protobuf.CodedOutputStream.writeRawByte ( final int  value) throws IOException
inline

Write a single byte, represented by an integer value.

◆ writeRawBytes() [1/4]

final void com.google.protobuf.CodedOutputStream.writeRawBytes ( final byte []  value) throws IOException
inline

Write an array of bytes.

◆ writeRawBytes() [2/4]

final void com.google.protobuf.CodedOutputStream.writeRawBytes ( final byte []  value,
int  offset,
int  length 
) throws IOException
inline

Write part of an array of bytes.

◆ writeRawBytes() [3/4]

final void com.google.protobuf.CodedOutputStream.writeRawBytes ( final ByteString  value) throws IOException
inline

Write a byte string.

◆ writeRawBytes() [4/4]

abstract void com.google.protobuf.CodedOutputStream.writeRawBytes ( final ByteBuffer  value) throws IOException
abstract

Write a ByteBuffer. This method will write all content of the ByteBuffer regardless of the current position and limit (i.e., the number of bytes to be written is value.capacity(), not value.remaining()). Furthermore, this method doesn't alter the state of the passed-in ByteBuffer. Its position, limit, mark, etc. will remain unchanged. If you only want to write the remaining bytes of a ByteBuffer, you can call

writeRawBytes(byteBuffer.slice())

.

◆ writeRawLittleEndian32()

final void com.google.protobuf.CodedOutputStream.writeRawLittleEndian32 ( final int  value) throws IOException
inline

Write a little-endian 32-bit integer.

Deprecated:
Use writeFixed32NoTag instead.

◆ writeRawLittleEndian64()

final void com.google.protobuf.CodedOutputStream.writeRawLittleEndian64 ( final long  value) throws IOException
inline

Write a little-endian 64-bit integer.

Deprecated:
Use writeFixed64NoTag instead.

◆ writeRawMessageSetExtension()

abstract void com.google.protobuf.CodedOutputStream.writeRawMessageSetExtension ( final int  fieldNumber,
final ByteString  value 
) throws IOException
abstract

Write an unparsed MessageSet extension field to the stream. For historical reasons, the wire format differs from normal fields.

◆ writeRawVarint32()

final void com.google.protobuf.CodedOutputStream.writeRawVarint32 ( int  value) throws IOException
inline

Encode and write a varint.

is treated as unsigned, so it won't be sign-extended if negative.

Deprecated:
use writeUInt32NoTag instead.

◆ writeRawVarint64()

final void com.google.protobuf.CodedOutputStream.writeRawVarint64 ( long  value) throws IOException
inline

Encode and write a varint.

Deprecated:
use writeUInt64NoTag instead.

◆ writeSFixed32()

final void com.google.protobuf.CodedOutputStream.writeSFixed32 ( final int  fieldNumber,
final int  value 
) throws IOException
inline

Write an

sfixed32

field, including tag, to the stream.

◆ writeSFixed32NoTag()

final void com.google.protobuf.CodedOutputStream.writeSFixed32NoTag ( final int  value) throws IOException
inline

Write a

sfixed32

field to the stream.

◆ writeSFixed64()

final void com.google.protobuf.CodedOutputStream.writeSFixed64 ( final int  fieldNumber,
final long  value 
) throws IOException
inline

Write an

sfixed64

field, including tag, to the stream.

◆ writeSFixed64NoTag()

final void com.google.protobuf.CodedOutputStream.writeSFixed64NoTag ( final long  value) throws IOException
inline

Write a

sfixed64

field to the stream.

◆ writeSInt32()

final void com.google.protobuf.CodedOutputStream.writeSInt32 ( final int  fieldNumber,
final int  value 
) throws IOException
inline

Write a

sint32

field, including tag, to the stream.

◆ writeSInt32NoTag()

final void com.google.protobuf.CodedOutputStream.writeSInt32NoTag ( final int  value) throws IOException
inline

Write a

sint32

field to the stream.

◆ writeSInt64()

final void com.google.protobuf.CodedOutputStream.writeSInt64 ( final int  fieldNumber,
final long  value 
) throws IOException
inline

Write an

sint64

field, including tag, to the stream.

◆ writeSInt64NoTag()

final void com.google.protobuf.CodedOutputStream.writeSInt64NoTag ( final long  value) throws IOException
inline

Write a

sint64

field to the stream.

◆ writeString()

abstract void com.google.protobuf.CodedOutputStream.writeString ( int  fieldNumber,
String  value 
) throws IOException
abstract

Write a

string

field, including tag, to the stream.

◆ writeStringNoTag()

abstract void com.google.protobuf.CodedOutputStream.writeStringNoTag ( String  value) throws IOException
abstract

Write a

string

field to the stream.

◆ writeTag()

abstract void com.google.protobuf.CodedOutputStream.writeTag ( int  fieldNumber,
int  wireType 
) throws IOException
abstract

Encode and write a tag.

◆ writeUInt32()

abstract void com.google.protobuf.CodedOutputStream.writeUInt32 ( int  fieldNumber,
int  value 
) throws IOException
abstract

Write a

field, including tag, to the stream.

◆ writeUInt32NoTag()

abstract void com.google.protobuf.CodedOutputStream.writeUInt32NoTag ( int  value) throws IOException
abstract

Write a

field to the stream.

◆ writeUInt64()

abstract void com.google.protobuf.CodedOutputStream.writeUInt64 ( int  fieldNumber,
long  value 
) throws IOException
abstract

Write a

field, including tag, to the stream.

◆ writeUInt64NoTag()

abstract void com.google.protobuf.CodedOutputStream.writeUInt64NoTag ( long  value) throws IOException
abstract

Write a

field to the stream.

Member Data Documentation

◆ DEFAULT_BUFFER_SIZE

final int com.google.protobuf.CodedOutputStream.DEFAULT_BUFFER_SIZE = 4096
static

The buffer size used in newInstance(OutputStream).

◆ LITTLE_ENDIAN_32_SIZE

final int com.google.protobuf.CodedOutputStream.LITTLE_ENDIAN_32_SIZE = FIXED_32_SIZE
static

The documentation for this class was generated from the following file: