Top Description Inners Fields Constructors Methods
com.google.protobuf

public final Class Internal

extends Object
Class Inheritance
Imports
java.io.IOException, java.lang.reflect.Method, java.nio.ByteBuffer, java.nio.charset.Charset, java.util.AbstractList, .AbstractMap, .AbstractSet, .Arrays, .Iterator, .List, .Map, .RandomAccess, .Set

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 protobuf package. Others should not use this class directly.
Author
[email protected] (Kenton Varda)

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static interface
Internal.BooleanList

A java.util.List implementation that avoids boxing the elements into Booleans if possible.

public static interface
Internal.DoubleList

A java.util.List implementation that avoids boxing the elements into Doubles if possible.

public static interface
Internal.EnumLite

Interface for an enum value or value descriptor, to be used in FieldSet.

public static interface
Internal.EnumLiteMap<T extends Internal.EnumLite>

Interface for an object which maps integers to EnumLites.

public static interface
Internal.EnumVerifier

Interface for an object which verifies integers are in range.

public static interface
Internal.FloatList

A java.util.List implementation that avoids boxing the elements into Floats if possible.

public static interface
Internal.IntList

A java.util.List implementation that avoids boxing the elements into Integers if possible.

public static class
Internal.ListAdapter<F, T>

Provides an immutable view of List<T> around a List<F>.

public static interface
Internal.LongList

A java.util.List implementation that avoids boxing the elements into Longs if possible.

public static class
Internal.MapAdapter<K, V, RealValue>

Wrap around a Map<K, RealValue> and provide a Map<K, V> interface.

public static interface
Internal.ProtobufList<E>

Extends List to add the capability to make the list immutable and inspect if it is modifiable.

Field Summary

Modifier and TypeField and Description
private static final int
public static final byte[]
EMPTY_BYTE_ARRAY

An empty byte array constant used in generated code.

public static final ByteBuffer
EMPTY_BYTE_BUFFER

An empty byte array constant used in generated code.

public static final CodedInputStream
EMPTY_CODED_INPUT_STREAM

An empty coded input stream constant used in generated code.

pack-priv static final Charset
pack-priv static final Charset

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static byte[]
byteArrayDefaultValue(String bytes)

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

public static ByteBuffer
byteBufferDefaultValue(String bytes)

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

public static ByteString
bytesDefaultValue(String bytes)

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

pack-priv static <T> T
checkNotNull(T obj)

Throws an appropriate NullPointerException if the given objects is null.

pack-priv static <T> T
checkNotNull(T obj, String message)

Throws an appropriate NullPointerException if the given objects is null.

public static ByteBuffer
copyByteBuffer(ByteBuffer source)

Create a new ByteBuffer and copy all the content of source ByteBuffer to the new ByteBuffer.

public static boolean
equals(List<byte[]> a, List<byte[]> b)

Helper method for implementing Message#equals(Object) for bytes field.

public static boolean
equalsByteBuffer(ByteBuffer a, ByteBuffer b)

Helper method for implementing Message#equals(Object) for bytes field.

public static boolean
equalsByteBuffer(List<ByteBuffer> a, List<ByteBuffer> b)

Helper method for implementing Message#equals(Object) for bytes field.

public static <T extends MessageLite> T
public static int
hashBoolean(boolean b)

Helper method for implementing Message#hashCode() for booleans.

public static int
hashCode(List<byte[]> list)

Helper method for implementing Message#hashCode() for bytes field.

public static int
hashCode(byte[] bytes)

Helper method for implementing Message#hashCode() for bytes field.

pack-priv static int
hashCode(byte[] bytes, int offset, int length)

Helper method for implementing LiteralByteString#hashCode().

public static int
hashCodeByteBuffer(List<ByteBuffer> list)

Helper method for implementing Message#hashCode() for bytes field.

public static int
hashCodeByteBuffer(ByteBuffer bytes)

Helper method for implementing Message#hashCode() for bytes field.

public static int
hashEnum(Internal.EnumLite e)

Helper method for implementing Message#hashCode() for enums.

public static int
hashEnumList(List<? extends Internal.EnumLite> list)

Helper method for implementing Message#hashCode() for enum lists.

public static int
hashLong(long n)

Helper method for implementing Message#hashCode() for longs.

public static boolean

Returns:

whether the byte array is round trippable
isValidUtf8
(ByteString
the string to check
byteString
)

Helper called by generated code to determine if a byte array is a valid UTF-8 encoded string such that the original bytes can be converted to a String object and then back to a byte array round tripping the bytes without loss.

public static boolean
isValidUtf8(byte[] byteArray)

Like isValidUtf8(ByteString) but for byte arrays.

pack-priv static Object
mergeMessage(Object destination, Object source)

Helper method to merge two MessageLite instances.

pack-priv static int
partialHash(int h, byte[] bytes, int offset, int length)

Helper method for continuously hashing bytes.

public static String
stringDefaultValue(String bytes)

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

public static byte[]
toByteArray(String value)

Helper method to get the UTF-8 bytes of a string.

public static String
toStringUtf8(byte[] bytes)

Helper method to convert a byte array to a string using UTF-8 encoding.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait