| java.lang.Object org.jivesoftware.util.cache.ExternalizableUtil
ExternalizableUtil | public class ExternalizableUtil (Code) | | Utility methods to assist in working with the Externalizable interfaces. This class
is only used when running inside of a Cluser. When using the open source version
this class will use a dummy implementation. Anyway, this class is not used when
not using the Enterprise edition.
ExternalizableLite is very similar to the standard Externalizable interface, except that
it uses DataOutput/DataInput instead of the Object stream equivalents.
author: Gaston Dombiak |
Method Summary | |
public static ExternalizableUtil | getInstance() | public ExternalizableUtilStrategy | getStrategy() Returns the implementation to use for serializing and deserializing
objects. | public boolean | readBoolean(DataInput in) | public byte[] | readByteArray(DataInput in) | public int | readExternalizableCollection(DataInput in, Collection<? extends Externalizable> value, ClassLoader loader) Reads a collection of Externalizable objects and adds them to the collection passed as a parameter. | public int | readExternalizableMap(DataInput in, Map<String, ? extends Externalizable> map, ClassLoader loader) Reads a Map of String key and value pairs. | public int | readInt(DataInput in) | public long | readLong(DataInput in) | public long[] | readLongArray(DataInput in) Reads an array of long values. | public Map | readLongIntMap(DataInput in) Reads a Map of Long key and Integer value pairs. | public String | readSafeUTF(DataInput in) | public Serializable | readSerializable(DataInput in) | public List<String> | readStringList(DataInput in) Reads a List of Strings. | public Map<String, String> | readStringMap(DataInput in) Reads a Map of String key and value pairs. | public int | readStrings(DataInput in, Collection<String> collection) Reads the string array from the input stream and adds them to the specified collection. | public int | readStringsMap(DataInput in, Map<String, Set<String>> map) Reads a Map of String key and Set of Strings value pairs.
Parameters: in - the input stream. Parameters: map - a Map of String key and Set of Strings value pairs. | public void | setStrategy(ExternalizableUtilStrategy strategy) Sets the implementation to use for serializing and deserializing
objects. | public void | writeBoolean(DataOutput out, boolean value) | public void | writeByteArray(DataOutput out, byte[] value) | public void | writeExternalizableCollection(DataOutput out, Collection<? extends Externalizable> value) Writes a collection of Externalizable objects. | public void | writeExternalizableMap(DataOutput out, Map<String, ? extends Externalizable> map) Writes a Map of String key and value pairs. | public void | writeInt(DataOutput out, int value) | public void | writeLong(DataOutput out, long value) | public void | writeLongArray(DataOutput out, long[] array) Writes an array of long values. | public void | writeLongIntMap(DataOutput out, Map<Long, Integer> map) Writes a Map of Long key and Integer value pairs. | public void | writeSafeUTF(DataOutput out, String value) | public void | writeSerializable(DataOutput out, Serializable value) | public void | writeStringList(DataOutput out, List stringList) Writes a List of Strings. | public void | writeStringMap(DataOutput out, Map<String, String> stringMap) Writes a Map of String key and value pairs. | public void | writeStrings(DataOutput out, Collection<String> collection) Writes content of collection of strings to the output stream. | public void | writeStringsMap(DataOutput out, Map<String, Set<String>> map) Writes a Map of String key and Set of Strings value pairs. |
getStrategy | public ExternalizableUtilStrategy getStrategy()(Code) | | Returns the implementation to use for serializing and deserializing
objects.
the implementation to use for serializing and deserializingobjects. |
readExternalizableCollection | public int readExternalizableCollection(DataInput in, Collection<? extends Externalizable> value, ClassLoader loader) throws IOException(Code) | | Reads a collection of Externalizable objects and adds them to the collection passed as a parameter. The
collection passed as a parameter must be a collection and not a null value.
Parameters: in - the input stream. Parameters: value - the collection of Externalizable objects. This value must not be null. Parameters: loader - class loader to use to build elements inside of the serialized collection. throws: IOException - if an error occurs. the number of elements added to the collection. |
readExternalizableMap | public int readExternalizableMap(DataInput in, Map<String, ? extends Externalizable> map, ClassLoader loader) throws IOException(Code) | | Reads a Map of String key and value pairs. This method will return
null if the Map written to the stream was null.
Parameters: in - the input stream. Parameters: map - a Map of String key and Externalizable value pairs. Parameters: loader - class loader to use to build elements inside of the serialized collection. throws: IOException - if an error occurs. the number of elements added to the collection. |
readLongArray | public long[] readLongArray(DataInput in) throws IOException(Code) | | Reads an array of long values. This method will return null if
the array written to the stream was null.
Parameters: in - the input stream. an array of long values. throws: IOException - if an error occurs. |
readLongIntMap | public Map readLongIntMap(DataInput in) throws IOException(Code) | | Reads a Map of Long key and Integer value pairs. This method will return
null if the Map written to the stream was null.
Parameters: in - the input stream. a Map of Long key/Integer value pairs. throws: IOException - if an error occurs. |
readStringList | public List<String> readStringList(DataInput in) throws IOException(Code) | | Reads a List of Strings. This method will return null if the List
written to the stream was null.
Parameters: in - the input stream. a List of Strings. throws: IOException - if an error occurs. |
readStringMap | public Map<String, String> readStringMap(DataInput in) throws IOException(Code) | | Reads a Map of String key and value pairs. This method will return
null if the Map written to the stream was null.
Parameters: in - the input stream. a Map of String key/value pairs. throws: IOException - if an error occurs. |
readStrings | public int readStrings(DataInput in, Collection<String> collection) throws IOException(Code) | | Reads the string array from the input stream and adds them to the specified collection.
Parameters: in - the input stream. Parameters: collection - the collection to add the read strings from the input stream. number of elements added to the collection. throws: IOException - if an error occurs. |
readStringsMap | public int readStringsMap(DataInput in, Map<String, Set<String>> map) throws IOException(Code) | | Reads a Map of String key and Set of Strings value pairs.
Parameters: in - the input stream. Parameters: map - a Map of String key and Set of Strings value pairs. number of elements added to the collection. throws: IOException - if an error occurs. |
setStrategy | public void setStrategy(ExternalizableUtilStrategy strategy)(Code) | | Sets the implementation to use for serializing and deserializing
objects.
Parameters: strategy - the new strategy to use. |
writeExternalizableCollection | public void writeExternalizableCollection(DataOutput out, Collection<? extends Externalizable> value) throws IOException(Code) | | Writes a collection of Externalizable objects. The collection passed as a parameter
must be a collection and not a null value.
Parameters: out - the output stream. Parameters: value - the collection of Externalizable objects. This value must not be null. throws: IOException - if an error occurs. |
writeExternalizableMap | public void writeExternalizableMap(DataOutput out, Map<String, ? extends Externalizable> map) throws IOException(Code) | | Writes a Map of String key and value pairs. This method handles the
case when the Map is null.
Parameters: out - the output stream. Parameters: map - the Map of String key and Externalizable value pairs. throws: java.io.IOException - if an error occurs. |
writeLongArray | public void writeLongArray(DataOutput out, long[] array) throws IOException(Code) | | Writes an array of long values. This method handles the case when the
array is null.
Parameters: out - the output stream. Parameters: array - the array of long values. throws: IOException - if an error occurs. |
writeLongIntMap | public void writeLongIntMap(DataOutput out, Map<Long, Integer> map) throws IOException(Code) | | Writes a Map of Long key and Integer value pairs. This method handles
the case when the Map is null.
Parameters: out - the output stream. Parameters: map - the Map of Long key/Integer value pairs. throws: IOException - if an error occurs. |
writeStringList | public void writeStringList(DataOutput out, List stringList) throws IOException(Code) | | Writes a List of Strings. This method handles the case when the List is
null.
Parameters: out - the output stream. Parameters: stringList - the List of Strings. throws: IOException - if an error occurs. |
writeStringMap | public void writeStringMap(DataOutput out, Map<String, String> stringMap) throws IOException(Code) | | Writes a Map of String key and value pairs. This method handles the
case when the Map is null.
Parameters: out - the output stream. Parameters: stringMap - the Map of String key/value pairs. throws: java.io.IOException - if an error occurs. |
writeStrings | public void writeStrings(DataOutput out, Collection<String> collection) throws IOException(Code) | | Writes content of collection of strings to the output stream.
Parameters: out - the output stream. Parameters: collection - the Collection of Strings. throws: IOException - if an error occurs. |
writeStringsMap | public void writeStringsMap(DataOutput out, Map<String, Set<String>> map) throws IOException(Code) | | Writes a Map of String key and Set of Strings value pairs. This method DOES NOT handle the
case when the Map is null.
Parameters: out - the output stream. Parameters: map - the Map of String key and Set of Strings value pairs. throws: java.io.IOException - if an error occurs. |
|
|