webkit  2cdf99a9e3038c7e01b3c37e8ad903ecbe5eecf1
https://github.com/WebKit/webkit
Static Public Member Functions | Static Public Attributes | Static Protected Attributes | List of all members
com.google.protobuf.nano.InternalNano Class Reference

Static Public Member Functions

static String stringDefaultValue (String bytes)
 
static byte [] bytesDefaultValue (String bytes)
 
static byte [] copyFromUtf8 (final String text)
 
static boolean equals (int[] field1, int[] field2)
 
static boolean equals (long[] field1, long[] field2)
 
static boolean equals (float[] field1, float[] field2)
 
static boolean equals (double[] field1, double[] field2)
 
static boolean equals (boolean[] field1, boolean[] field2)
 
static boolean equals (byte[][] field1, byte[][] field2)
 
static boolean equals (Object[] field1, Object[] field2)
 
static int hashCode (int[] field)
 
static int hashCode (long[] field)
 
static int hashCode (float[] field)
 
static int hashCode (double[] field)
 
static int hashCode (boolean[] field)
 
static int hashCode (byte[][] field)
 
static int hashCode (Object[] field)
 
static final< K, V > Map< K, V > mergeMapEntry (CodedInputByteBufferNano input, Map< K, V > map, MapFactory mapFactory, int keyType, int valueType, V value, int keyTag, int valueTag) throws IOException
 
static< K, V > void serializeMapField (CodedOutputByteBufferNano output, Map< K, V > map, int number, int keyType, int valueType) throws IOException
 
static< K, V > int computeMapFieldSize (Map< K, V > map, int number, int keyType, int valueType)
 
static< K, V > boolean equals (Map< K, V > a, Map< K, V > b)
 
static< K, V > int hashCode (Map< K, V > map)
 
static void cloneUnknownFieldData (ExtendableMessageNano original, ExtendableMessageNano cloned)
 

Static Public Attributes

static final int TYPE_DOUBLE = 1
 
static final int TYPE_FLOAT = 2
 
static final int TYPE_INT64 = 3
 
static final int TYPE_UINT64 = 4
 
static final int TYPE_INT32 = 5
 
static final int TYPE_FIXED64 = 6
 
static final int TYPE_FIXED32 = 7
 
static final int TYPE_BOOL = 8
 
static final int TYPE_STRING = 9
 
static final int TYPE_GROUP = 10
 
static final int TYPE_MESSAGE = 11
 
static final int TYPE_BYTES = 12
 
static final int TYPE_UINT32 = 13
 
static final int TYPE_ENUM = 14
 
static final int TYPE_SFIXED32 = 15
 
static final int TYPE_SFIXED64 = 16
 
static final int TYPE_SINT32 = 17
 
static final int TYPE_SINT64 = 18
 
static final Object LAZY_INIT_LOCK = new Object()
 

Static Protected Attributes

static final Charset UTF_8 = Charset.forName("UTF-8")
 
static final Charset ISO_8859_1 = Charset.forName("ISO-8859-1")
 

Detailed Description

The classes contained within are used internally by the Protocol Buffer library and generated message implementations. They are public only because those generated messages do not reside in the

package. Others should not use this class directly.

Author
kento.nosp@m.n@go.nosp@m.ogle..nosp@m.com (Kenton Varda)

Member Function Documentation

◆ bytesDefaultValue()

static byte [] com.google.protobuf.nano.InternalNano.bytesDefaultValue ( String  bytes)
inlinestatic

Helper called by generated code to construct default values for bytes fields.

This is a lot like stringDefaultValue, but for bytes fields. In this case we only need the second of the two hacks – allowing us to embed raw bytes as a string literal with ISO-8859-1 encoding.

◆ cloneUnknownFieldData()

static void com.google.protobuf.nano.InternalNano.cloneUnknownFieldData ( ExtendableMessageNano  original,
ExtendableMessageNano  cloned 
)
inlinestatic

◆ computeMapFieldSize()

static <K, V> int com.google.protobuf.nano.InternalNano.computeMapFieldSize ( Map< K, V >  map,
int  number,
int  keyType,
int  valueType 
)
inlinestatic

◆ copyFromUtf8()

static byte [] com.google.protobuf.nano.InternalNano.copyFromUtf8 ( final String  text)
inlinestatic

Helper function to convert a string into UTF-8 while turning the UnsupportedEncodingException to a RuntimeException.

◆ equals() [1/8]

static boolean com.google.protobuf.nano.InternalNano.equals ( int []  field1,
int []  field2 
)
inlinestatic

Checks repeated int field equality; null-value and 0-length fields are considered equal.

◆ equals() [2/8]

static boolean com.google.protobuf.nano.InternalNano.equals ( long []  field1,
long []  field2 
)
inlinestatic

Checks repeated long field equality; null-value and 0-length fields are considered equal.

◆ equals() [3/8]

static boolean com.google.protobuf.nano.InternalNano.equals ( float []  field1,
float []  field2 
)
inlinestatic

Checks repeated float field equality; null-value and 0-length fields are considered equal.

◆ equals() [4/8]

static boolean com.google.protobuf.nano.InternalNano.equals ( double []  field1,
double []  field2 
)
inlinestatic

Checks repeated double field equality; null-value and 0-length fields are considered equal.

◆ equals() [5/8]

static boolean com.google.protobuf.nano.InternalNano.equals ( boolean []  field1,
boolean []  field2 
)
inlinestatic

Checks repeated boolean field equality; null-value and 0-length fields are considered equal.

◆ equals() [6/8]

static boolean com.google.protobuf.nano.InternalNano.equals ( byte  field1[][],
byte  field2[][] 
)
inlinestatic

Checks repeated bytes field equality. Only non-null elements are tested. Returns true if the two fields have the same sequence of non-null elements. Null-value fields and fields of any length with only null elements are considered equal.

◆ equals() [7/8]

static boolean com.google.protobuf.nano.InternalNano.equals ( Object []  field1,
Object []  field2 
)
inlinestatic

Checks repeated string/message field equality. Only non-null elements are tested. Returns true if the two fields have the same sequence of non-null elements. Null-value fields and fields of any length with only null elements are considered equal.

◆ equals() [8/8]

static <K, V> boolean com.google.protobuf.nano.InternalNano.equals ( Map< K, V >  a,
Map< K, V >  b 
)
inlinestatic

Checks whether two Map are equal. We don't use the default equals method of Map because it compares by identity not by content for byte arrays.

◆ hashCode() [1/8]

static int com.google.protobuf.nano.InternalNano.hashCode ( int []  field)
inlinestatic

Computes the hash code of a repeated int field. Null-value and 0-length fields have the same hash code.

◆ hashCode() [2/8]

static int com.google.protobuf.nano.InternalNano.hashCode ( long []  field)
inlinestatic

Computes the hash code of a repeated long field. Null-value and 0-length fields have the same hash code.

◆ hashCode() [3/8]

static int com.google.protobuf.nano.InternalNano.hashCode ( float []  field)
inlinestatic

Computes the hash code of a repeated float field. Null-value and 0-length fields have the same hash code.

◆ hashCode() [4/8]

static int com.google.protobuf.nano.InternalNano.hashCode ( double []  field)
inlinestatic

Computes the hash code of a repeated double field. Null-value and 0-length fields have the same hash code.

◆ hashCode() [5/8]

static int com.google.protobuf.nano.InternalNano.hashCode ( boolean []  field)
inlinestatic

Computes the hash code of a repeated boolean field. Null-value and 0-length fields have the same hash code.

◆ hashCode() [6/8]

static int com.google.protobuf.nano.InternalNano.hashCode ( byte  field[][])
inlinestatic

Computes the hash code of a repeated bytes field. Only the sequence of all non-null elements are used in the computation. Null-value fields and fields of any length with only null elements have the same hash code.

◆ hashCode() [7/8]

static int com.google.protobuf.nano.InternalNano.hashCode ( Object []  field)
inlinestatic

Computes the hash code of a repeated string/message field. Only the sequence of all non-null elements are used in the computation. Null-value fields and fields of any length with only null elements have the same hash code.

◆ hashCode() [8/8]

static <K, V> int com.google.protobuf.nano.InternalNano.hashCode ( Map< K, V >  map)
inlinestatic

◆ mergeMapEntry()

static final<K, V> Map<K, V> com.google.protobuf.nano.InternalNano.mergeMapEntry ( CodedInputByteBufferNano  input,
Map< K, V >  map,
MapFactory  mapFactory,
int  keyType,
int  valueType,
value,
int  keyTag,
int  valueTag 
) throws IOException
inlinestatic

Merges the map entry into the map field. Note this is only supposed to be called by generated messages.

Parameters
mapthe map field; may be null, in which case a map will be instantiated using the MapFactories.MapFactory
inputthe input byte buffer
keyTypekey type, as defined in InternalNano.TYPE_*
valueTypevalue type, as defined in InternalNano.TYPE_*
valuean new instance of the value, if the value is a TYPE_MESSAGE; otherwise this parameter can be null and will be ignored.
keyTagwire tag for the key
valueTagwire tag for the value
Returns
the map field
Exceptions
IOException

◆ serializeMapField()

static <K, V> void com.google.protobuf.nano.InternalNano.serializeMapField ( CodedOutputByteBufferNano  output,
Map< K, V >  map,
int  number,
int  keyType,
int  valueType 
) throws IOException
inlinestatic

◆ stringDefaultValue()

static String com.google.protobuf.nano.InternalNano.stringDefaultValue ( String  bytes)
inlinestatic

Helper called by generated code to construct default values for string fields.

The protocol compiler does not actually contain a UTF-8 decoder – it just pushes UTF-8-encoded text around without touching it. The one place where this presents a problem is when generating Java string literals. Unicode characters in the string literal would normally need to be encoded using a Unicode escape sequence, which would require decoding them. To get around this, protoc instead embeds the UTF-8 bytes into the generated code and leaves it to the runtime library to decode them.

It gets worse, though. If protoc just generated a byte array, like: new byte[] {0x12, 0x34, 0x56, 0x78} Java actually generates code which allocates an array and then fills in each value. This is much less efficient than just embedding the bytes directly into the bytecode. To get around this, we need another work-around. String literals are embedded directly, so protoc actually generates a string literal corresponding to the bytes. The easiest way to do this is to use the ISO-8859-1 character set, which corresponds to the first 256 characters of the Unicode range. Protoc can then use good old CEscape to generate the string.

So we have a string literal which represents a set of bytes which represents another string. This function – stringDefaultValue – converts from the generated string to the string we actually want. The generated code calls this automatically.

Member Data Documentation

◆ ISO_8859_1

final Charset com.google.protobuf.nano.InternalNano.ISO_8859_1 = Charset.forName("ISO-8859-1")
staticprotected

◆ LAZY_INIT_LOCK

final Object com.google.protobuf.nano.InternalNano.LAZY_INIT_LOCK = new Object()
static

An object to provide synchronization when lazily initializing static fields of MessageNano subclasses.

To enable earlier versions of ProGuard to inline short methods from a generated MessageNano subclass to the call sites, that class must not have a class initializer, which will be created if there is any static variable initializers. To lazily initialize the static variables in a thread-safe manner, the initialization code will synchronize on this object.

◆ TYPE_BOOL

final int com.google.protobuf.nano.InternalNano.TYPE_BOOL = 8
static

◆ TYPE_BYTES

final int com.google.protobuf.nano.InternalNano.TYPE_BYTES = 12
static

◆ TYPE_DOUBLE

final int com.google.protobuf.nano.InternalNano.TYPE_DOUBLE = 1
static

◆ TYPE_ENUM

final int com.google.protobuf.nano.InternalNano.TYPE_ENUM = 14
static

◆ TYPE_FIXED32

final int com.google.protobuf.nano.InternalNano.TYPE_FIXED32 = 7
static

◆ TYPE_FIXED64

final int com.google.protobuf.nano.InternalNano.TYPE_FIXED64 = 6
static

◆ TYPE_FLOAT

final int com.google.protobuf.nano.InternalNano.TYPE_FLOAT = 2
static

◆ TYPE_GROUP

final int com.google.protobuf.nano.InternalNano.TYPE_GROUP = 10
static

◆ TYPE_INT32

final int com.google.protobuf.nano.InternalNano.TYPE_INT32 = 5
static

◆ TYPE_INT64

final int com.google.protobuf.nano.InternalNano.TYPE_INT64 = 3
static

◆ TYPE_MESSAGE

final int com.google.protobuf.nano.InternalNano.TYPE_MESSAGE = 11
static

◆ TYPE_SFIXED32

final int com.google.protobuf.nano.InternalNano.TYPE_SFIXED32 = 15
static

◆ TYPE_SFIXED64

final int com.google.protobuf.nano.InternalNano.TYPE_SFIXED64 = 16
static

◆ TYPE_SINT32

final int com.google.protobuf.nano.InternalNano.TYPE_SINT32 = 17
static

◆ TYPE_SINT64

final int com.google.protobuf.nano.InternalNano.TYPE_SINT64 = 18
static

◆ TYPE_STRING

final int com.google.protobuf.nano.InternalNano.TYPE_STRING = 9
static

◆ TYPE_UINT32

final int com.google.protobuf.nano.InternalNano.TYPE_UINT32 = 13
static

◆ TYPE_UINT64

final int com.google.protobuf.nano.InternalNano.TYPE_UINT64 = 4
static

◆ UTF_8

final Charset com.google.protobuf.nano.InternalNano.UTF_8 = Charset.forName("UTF-8")
staticprotected

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