Go to the documentation of this file.
31 package com.google.protobuf;
33 import java.io.IOException;
35 import java.nio.ByteBuffer;
36 import java.nio.charset.Charset;
37 import java.util.AbstractList;
38 import java.util.AbstractMap;
39 import java.util.AbstractSet;
40 import java.util.Arrays;
41 import java.util.Iterator;
42 import java.util.List;
44 import java.util.RandomAccess;
58 static final Charset UTF_8 = Charset.forName(
"UTF-8");
59 static final Charset ISO_8859_1 = Charset.forName(
"ISO-8859-1");
62 static <T>
T checkNotNull(
T obj) {
64 throw new NullPointerException();
72 throw new NullPointerException(
message);
100 return new String(
bytes.getBytes(ISO_8859_1), UTF_8);
119 return bytes.getBytes(ISO_8859_1);
139 ByteBuffer temp =
source.duplicate();
143 ByteBuffer result = ByteBuffer.allocate(temp.capacity());
176 return byteString.isValidUtf8();
181 return Utf8.isValidUtf8(byteArray);
186 return value.getBytes(UTF_8);
191 return new String(
bytes, UTF_8);
225 return (
int) (
n ^ (
n >>> 32));
234 return b ? 1231 : 1237;
258 public static boolean equals(List<
byte[]>
a, List<
byte[]>
b) {
259 if (
a.size() !=
b.size())
return false;
260 for (
int i = 0;
i <
a.size(); ++
i) {
261 if (!Arrays.equals(
a.get(
i),
b.get(
i))) {
271 for (
byte[]
bytes : list) {
293 return h == 0 ? 1 :
h;
306 if (
a.capacity() !=
b.capacity()) {
311 return a.duplicate().clear().equals(
b.duplicate().clear());
316 if (
a.size() !=
b.size()) {
319 for (
int i = 0;
i <
a.size(); ++
i) {
330 for (ByteBuffer
bytes : list) {
340 if (
bytes.hasArray()) {
343 return h == 0 ? 1 :
h;
347 final int bufferSize =
349 final byte[]
buffer =
new byte[bufferSize];
350 final ByteBuffer duplicated =
bytes.duplicate();
353 while (duplicated.remaining() > 0) {
355 duplicated.remaining() <= bufferSize ? duplicated.remaining() : bufferSize;
359 return h == 0 ? 1 :
h;
363 @SuppressWarnings(
"unchecked")
368 }
catch (Exception e) {
369 throw new RuntimeException(
"Failed to get default instance for " + clazz, e);
386 static Object mergeMessage(Object destination, Object
source) {
421 public static class MapAdapter<
K, V, RealValue>
extends AbstractMap<K, V> {
433 public T doForward(Integer
value) {
435 return result ==
null ? unrecognizedValue : result;
439 public Integer doBackward(
T value) {
440 return value.getNumber();
453 @SuppressWarnings(
"unchecked")
455 public V
get(Object
key) {
457 if (result ==
null) {
466 if (oldValue ==
null) {
477 private class SetAdapter extends AbstractSet<Map.Entry<K, V>> {
513 public void remove() {
538 if (oldValue ==
null) {
549 if (!(o instanceof
Map.Entry)) {
552 @SuppressWarnings(
"unchecked")
553 Map.Entry<?, ?> other = (
Map.Entry<?, ?>) o;
570 public static interface ProtobufList<E>
extends List<E>, RandomAccess {
FloatList mutableCopyWithCapacity(int capacity)
final Converter< F, T > converter
Set< java.util.Map.Entry< K, V > > entrySet()
final Map< K, RealValue > realMap
static int hashEnumList(List<? extends EnumLite > list)
static byte[] byteArrayDefaultValue(String bytes)
static int hashEnum(EnumLite e)
ProtobufList< E > mutableCopyWithCapacity(int capacity)
void addFloat(float element)
static final byte[] EMPTY_BYTE_ARRAY
GLenum GLuint GLenum GLsizei length
static ByteString bytesDefaultValue(String bytes)
IteratorAdapter(Iterator< Map.Entry< K, RealValue >> realIterator)
double getDouble(int index)
static int hashCodeByteBuffer(ByteBuffer bytes)
float getFloat(int index)
EntryAdapter(Map.Entry< K, RealValue > realEntry)
static< T extends EnumLite > Converter< Integer, T > newEnumConverter(final EnumLiteMap< T > enumMap, final T unrecognizedValue)
LongList mutableCopyWithCapacity(int capacity)
void addDouble(double element)
static ByteBuffer copyByteBuffer(ByteBuffer source)
float setFloat(int index, float element)
static int hashCode(List< byte[]> list)
#define T(upbtypeconst, upbtype, ctype, default_value)
java.util.Map.Entry< K, V > next()
static boolean equalsByteBuffer(ByteBuffer a, ByteBuffer b)
boolean getBoolean(int index)
boolean isInRange(int number)
static final ByteBuffer EMPTY_BYTE_BUFFER
static final int DEFAULT_BUFFER_SIZE
final Set< Map.Entry< K, RealValue > > realSet
GLboolean GLboolean GLboolean b
T findValueByNumber(int number)
GLsizei GLsizei GLuint * obj
static int hashBoolean(boolean b)
static String stringDefaultValue(String bytes)
Iterator< java.util.Map.Entry< K, V > > iterator()
static String toStringUtf8(byte[] bytes)
boolean setBoolean(int index, boolean element)
static ByteBuffer byteBufferDefaultValue(String bytes)
static int hashCode(byte[] bytes)
static final CodedInputStream EMPTY_CODED_INPUT_STREAM
static int hashLong(long n)
GLsizei GLsizei GLchar * source
static boolean isValidUtf8(byte[] byteArray)
const SETUP_TEARDOWN_TESTCONTEXT char * key
final Converter< RealValue, V > valueConverter
SetAdapter(Set< Map.Entry< K, RealValue >> realSet)
static boolean isValidUtf8(ByteString byteString)
double setDouble(int index, double element)
ListAdapter(List< F > fromList, Converter< F, T > converter)
int setInt(int index, int element)
static< T extends MessageLite > T getDefaultInstance(Class< T > clazz)
BooleanList mutableCopyWithCapacity(int capacity)
void addBoolean(boolean element)
static int hashCodeByteBuffer(List< ByteBuffer > list)
DoubleList mutableCopyWithCapacity(int capacity)
MapAdapter(Map< K, RealValue > realMap, Converter< RealValue, V > valueConverter)
final Map.Entry< K, RealValue > realEntry
static boolean equalsByteBuffer(List< ByteBuffer > a, List< ByteBuffer > b)
static boolean equals(List< byte[]> a, List< byte[]> b)
GLsizei const GLfloat * value
long setLong(int index, long element)
static byte[] toByteArray(String value)
IntList mutableCopyWithCapacity(int capacity)
GLboolean GLboolean GLboolean GLboolean a
void addLong(long element)
final Iterator< Map.Entry< K, RealValue > > realIterator
GLenum GLuint GLenum GLsizei const GLchar * message
const Descriptor::ReservedRange const EnumValueDescriptor method
GLfloat GLfloat GLfloat GLfloat h
libaditof
Author(s):
autogenerated on Wed May 21 2025 02:06:54