public final class WireOutput extends Object
| Modifier and Type | Method and Description |
|---|---|
static int |
int32Size(int value)
Computes the number of bytes that would be needed to encode a signed variable-length integer
of up to 32 bits.
|
static int |
int64Size(long value)
Computes the number of bytes that would be needed to encode a signed variable-length integer
of up to 64 bits.
|
static int |
makeTag(int fieldNumber,
WireType wireType)
Makes a tag value given a field number and wire type.
|
static int |
messageHeaderSize(int fieldNumber,
int byteCount)
Returns the length in bytes of a message header consisting of a field number, wire type,
and message length in bytes.
|
static int |
messageSize(int fieldNumber,
int messageLength)
Computes the number of bytes that would be needed to encode a message
field with a given tag number and length.
|
static int |
tagSize(int fieldNumber,
WireType wireType)
Computes the number of bytes that would be needed to encode a tag.
|
static int |
writeMessageHeader(int fieldNumber,
byte[] buffer,
int bufferOffset,
int byteCount)
Writes a message header into the given output array, consisting
of the field number, wire type, and message length in bytes.
|
static int |
writeTag(int fieldNumber,
WireType wireType,
byte[] buffer,
int offset)
Writes a tag value (as a variable-length integer combining a field number and
wire type) to the given output array.
|
static int |
writeVarint(long value,
byte[] buffer,
int offset)
Writes a variable-length integer into the given output array.
|
public static int int32Size(int value)
public static int int64Size(long value)
public static int tagSize(int fieldNumber,
WireType wireType)
public static int messageSize(int fieldNumber,
int messageLength)
public static int writeTag(int fieldNumber,
WireType wireType,
byte[] buffer,
int offset)
public static int writeVarint(long value,
byte[] buffer,
int offset)
public static int messageHeaderSize(int fieldNumber,
int byteCount)
public static int writeMessageHeader(int fieldNumber,
byte[] buffer,
int bufferOffset,
int byteCount)
bufferOffset - the offset at which to start writing to the output bufferpublic static int makeTag(int fieldNumber,
WireType wireType)
Copyright © 2013 Square, Inc.. All Rights Reserved.