Top Description Inners Constructors Methods
com.google.common.collect

pack-priv final Class Serialization

extends Object
Class Inheritance
Annotations
@GwtIncompatible
@J2ktIncompatible
@ElementTypesAreNonnullByDefault
Imports
com.google.common.annotations.GwtIncompatible, .J2ktIncompatible, java.io.IOException, .ObjectInputStream, .ObjectOutputStream, java.lang.reflect.Field, java.util.Collection, .Map, org.checkerframework.checker.nullness.qual.Nullable

Provides static methods for serializing collection classes.

This class assists the implementation of collection classes. Do not use this class to serialize collections that are defined elsewhere.

Author
Jared Levy

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
pack-priv static <T> Serialization.FieldSetter<T>
getFieldSetter(Class<T> clazz, String fieldName)

pack-priv static <K extends @Nullable Object, V extends @Nullable Object> void
populateMap(Map<K, V> map, ObjectInputStream stream)

Populates a map by reading an input stream, as part of deserialization.

pack-priv static <K extends @Nullable Object, V extends @Nullable Object> void
populateMap(Map<K, V> map, ObjectInputStream stream, int size)

Populates a map by reading an input stream, as part of deserialization.

pack-priv static <K extends @Nullable Object, V extends @Nullable Object> void
populateMultimap(Multimap<K, V> multimap, ObjectInputStream stream)

Populates a multimap by reading an input stream, as part of deserialization.

pack-priv static <K extends @Nullable Object, V extends @Nullable Object> void
populateMultimap(Multimap<K, V> multimap, ObjectInputStream stream, int distinctKeys)

Populates a multimap by reading an input stream, as part of deserialization.

pack-priv static <E extends @Nullable Object> void
populateMultiset(Multiset<E> multiset, ObjectInputStream stream)

Populates a multiset by reading an input stream, as part of deserialization.

pack-priv static <E extends @Nullable Object> void
populateMultiset(Multiset<E> multiset, ObjectInputStream stream, int distinctElements)

Populates a multiset by reading an input stream, as part of deserialization.

pack-priv static int
readCount(ObjectInputStream stream)

Reads a count corresponding to a serialized map, multiset, or multimap.

pack-priv static <K extends @Nullable Object, V extends @Nullable Object> void
writeMap(Map<K, V> map, ObjectOutputStream stream)

Stores the contents of a map in an output stream, as part of serialization.

pack-priv static <K extends @Nullable Object, V extends @Nullable Object> void
writeMultimap(Multimap<K, V> multimap, ObjectOutputStream stream)

Stores the contents of a multimap in an output stream, as part of serialization.

pack-priv static <E extends @Nullable Object> void
writeMultiset(Multiset<E> multiset, ObjectOutputStream stream)

Stores the contents of a multiset in an output stream, as part of serialization.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

Serializationback to summary
private Serialization()

Method Detail

getFieldSetterback to summary
pack-priv static <T> Serialization.FieldSetter<T> getFieldSetter(Class<T> clazz, String fieldName)
populateMapback to summary
pack-priv static <K extends @Nullable Object, V extends @Nullable Object> void populateMap(Map<K, V> map, ObjectInputStream stream) throws IOException, ClassNotFoundException

Populates a map by reading an input stream, as part of deserialization. See writeMap for the data format.

populateMapback to summary
pack-priv static <K extends @Nullable Object, V extends @Nullable Object> void populateMap(Map<K, V> map, ObjectInputStream stream, int size) throws IOException, ClassNotFoundException

Populates a map by reading an input stream, as part of deserialization. See writeMap for the data format. The size is determined by a prior call to readCount.

populateMultimapback to summary
pack-priv static <K extends @Nullable Object, V extends @Nullable Object> void populateMultimap(Multimap<K, V> multimap, ObjectInputStream stream) throws IOException, ClassNotFoundException

Populates a multimap by reading an input stream, as part of deserialization. See writeMultimap for the data format.

populateMultimapback to summary
pack-priv static <K extends @Nullable Object, V extends @Nullable Object> void populateMultimap(Multimap<K, V> multimap, ObjectInputStream stream, int distinctKeys) throws IOException, ClassNotFoundException

Populates a multimap by reading an input stream, as part of deserialization. See writeMultimap for the data format. The number of distinct keys is determined by a prior call to readCount.

populateMultisetback to summary
pack-priv static <E extends @Nullable Object> void populateMultiset(Multiset<E> multiset, ObjectInputStream stream) throws IOException, ClassNotFoundException

Populates a multiset by reading an input stream, as part of deserialization. See writeMultiset for the data format.

populateMultisetback to summary
pack-priv static <E extends @Nullable Object> void populateMultiset(Multiset<E> multiset, ObjectInputStream stream, int distinctElements) throws IOException, ClassNotFoundException

Populates a multiset by reading an input stream, as part of deserialization. See writeMultiset for the data format. The number of distinct elements is determined by a prior call to readCount.

readCountback to summary
pack-priv static int readCount(ObjectInputStream stream) throws IOException

Reads a count corresponding to a serialized map, multiset, or multimap. It returns the size of a map serialized by writeMap(Map, ObjectOutputStream), the number of distinct elements in a multiset serialized by writeMultiset(Multiset, ObjectOutputStream), or the number of distinct keys in a multimap serialized by writeMultimap(Multimap, ObjectOutputStream).

writeMapback to summary
pack-priv static <K extends @Nullable Object, V extends @Nullable Object> void writeMap(Map<K, V> map, ObjectOutputStream stream) throws IOException

Stores the contents of a map in an output stream, as part of serialization. It does not support concurrent maps whose content may change while the method is running.

The serialized output consists of the number of entries, first key, first value, second key, second value, and so on.

writeMultimapback to summary
pack-priv static <K extends @Nullable Object, V extends @Nullable Object> void writeMultimap(Multimap<K, V> multimap, ObjectOutputStream stream) throws IOException

Stores the contents of a multimap in an output stream, as part of serialization. It does not support concurrent multimaps whose content may change while the method is running. The Multimap#asMap view determines the ordering in which data is written to the stream.

The serialized output consists of the number of distinct keys, and then for each distinct key: the key, the number of values for that key, and the key's values.

writeMultisetback to summary
pack-priv static <E extends @Nullable Object> void writeMultiset(Multiset<E> multiset, ObjectOutputStream stream) throws IOException

Stores the contents of a multiset in an output stream, as part of serialization. It does not support concurrent multisets whose content may change while the method is running.

The serialized output consists of the number of distinct elements, the first element, its count, the second element, its count, and so on.

com.google.common.collect back to summary

pack-priv final Class Serialization.FieldSetter<T>

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final Field

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
pack-priv void
set(T instance, Object value)

pack-priv void
set(T instance, int value)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

fieldback to summary
private final Field field

Constructor Detail

FieldSetterback to summary
private FieldSetter(Field field)

Method Detail

setback to summary
pack-priv void set(T instance, Object value)
setback to summary
pack-priv void set(T instance, int value)