webkit
2cdf99a9e3038c7e01b3c37e8ad903ecbe5eecf1
https://github.com/WebKit/webkit
|
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 |
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.
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
. Calling
after writing verifies that the message was actually as big as expected, which can help catch bugs.
|
inlinestatic |
Compute the number of bytes that would be needed to encode a
field, including tag.
|
inlinestatic |
Compute the number of bytes that would be needed to encode a
field.
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
Compute the number of bytes that would be needed to encode a
field, including tag.
|
inlinestatic |
Compute the number of bytes that would be needed to encode a
field, including tag.
|
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).
|
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).
|
inlinestatic |
Compute the number of bytes that would be needed to encode a
field, including tag.
|
inlinestatic |
Compute the number of bytes that would be needed to encode a
field.
|
inlinestatic |
Compute the number of bytes that would be needed to encode a
field, including tag.
|
inlinestatic |
Compute the number of bytes that would be needed to encode a
field.
|
inlinestatic |
Compute the number of bytes that would be needed to encode a
field, including tag.
|
inlinestatic |
Compute the number of bytes that would be needed to encode a
field, including tag.
|
inlinestatic |
Compute the number of bytes that would be needed to encode a
field, including tag.
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
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.
|
inlinestatic |
Compute the number of bytes that would be needed to encode an embedded message in lazy field, including tag.
|
inlinestatic |
Compute the number of bytes that would be needed to encode an embedded message stored in lazy field.
|
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.
|
inlinestatic |
Compute the number of bytes that would be needed to encode an embedded message field, including tag.
|
inlinestatic |
Compute the number of bytes that would be needed to encode an embedded message field.
|
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.
|
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.
|
inlinestatic |
Compute the number of bytes that would be needed to encode a varint.
|
inlinestatic |
Compute the number of bytes that would be needed to encode an
field, including tag.
|
inlinestatic |
Compute the number of bytes that would be needed to encode an
field.
|
inlinestatic |
Compute the number of bytes that would be needed to encode an
field, including tag.
|
inlinestatic |
Compute the number of bytes that would be needed to encode an
field.
|
inlinestatic |
Compute the number of bytes that would be needed to encode an
field, including tag.
|
inlinestatic |
Compute the number of bytes that would be needed to encode an
field.
|
inlinestatic |
Compute the number of bytes that would be needed to encode an
field, including tag.
|
inlinestatic |
Compute the number of bytes that would be needed to encode an
field.
|
inlinestatic |
Compute the number of bytes that would be needed to encode a
field, including tag.
|
inlinestatic |
Compute the number of bytes that would be needed to encode a
field.
|
inlinestatic |
Compute the number of bytes that would be needed to encode a tag.
|
inlinestatic |
|
inlinestatic |
|
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.)
n | A signed 32-bit integer. |
|
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.)
n | A signed 64-bit integer. |
|
abstract |
Flushes the stream and forces any buffered bytes to be written. This does not flush the underlying OutputStream.
|
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.
|
inlinestatic |
Create a new
wrapping the given
.
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.
|
inlinestatic |
Create a new
wrapping the given
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.
|
inlinestatic |
Create a new
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
. See also ByteString#newCodedBuilder.
|
inlinestatic |
Create a new
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
. See also ByteString#newCodedBuilder.
|
inlinestatic |
|
inlinestatic |
Create a new
that writes to the given ByteBuffer.
|
abstract |
If writing to a flat array, return the space left in the array. Otherwise, throws
.
|
abstract |
|
abstract |
|
abstract |
|
abstract |
Write a
field, including tag, to the stream.
|
inline |
Write a
field to the stream.
|
abstract |
|
abstract |
|
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
.
|
abstract |
|
abstract |
|
inline |
Write a
field, including tag, to the stream.
|
inline |
Write a
field to the stream.
|
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).
|
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).
|
abstract |
Write a
field, including tag, to the stream.
|
abstract |
Write a
field to the stream.
|
abstract |
Write a
field, including tag, to the stream.
|
abstract |
Write a
field to the stream.
|
inline |
Write a
field, including tag, to the stream.
|
inline |
Write a
field to the stream.
|
inline |
|
inline |
|
abstract |
|
abstract |
|
abstract |
|
abstract |
Write an embedded message field, including tag, to the stream.
|
abstract |
Write an embedded message field to the stream.
|
abstract |
Write a MessageSet extension field to the stream. For historical reasons, the wire format differs from normal fields.
|
inline |
Write a single byte.
|
inline |
Write a single byte, represented by an integer value.
|
inline |
Write an array of bytes.
|
inline |
Write part of an array of bytes.
|
inline |
Write a byte string.
|
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
.
|
inline |
Write a little-endian 32-bit integer.
|
inline |
Write a little-endian 64-bit integer.
|
abstract |
Write an unparsed MessageSet extension field to the stream. For historical reasons, the wire format differs from normal fields.
|
inline |
Encode and write a varint.
is treated as unsigned, so it won't be sign-extended if negative.
|
inline |
Encode and write a varint.
|
inline |
Write an
field, including tag, to the stream.
|
inline |
Write a
field to the stream.
|
inline |
Write an
field, including tag, to the stream.
|
inline |
Write a
field to the stream.
|
inline |
Write a
field, including tag, to the stream.
|
inline |
Write a
field to the stream.
|
inline |
Write an
field, including tag, to the stream.
|
inline |
Write a
field to the stream.
|
abstract |
Write a
field, including tag, to the stream.
|
abstract |
Write a
field to the stream.
|
abstract |
Encode and write a tag.
|
abstract |
|
abstract |
|
abstract |
|
abstract |
|
static |
The buffer size used in newInstance(OutputStream).
|
static |