VMware GemFire Java API Reference
Class DataSerializer
- java.lang.Object
- 
- org.apache.geode.DataSerializer
 
- 
 public abstract class DataSerializer extends java.lang.ObjectProvides static helper methods for reading and writing non-primitive data when working with aDataSerializable. For instance, classes that implementDataSerializablecan use theDataSerializerin theirtoDataandfromDatamethods:public class Employee implements DataSerializable { private int id; private String name; private Date birthday; private Company employer; public void toData(DataOutput out) throws IOException { out.writeInt(this.id); out.writeUTF(this.name); DataSerializer.writeDate(this.birthday, out); DataSerializer.writeObject(this.employer, out); } public void fromData(DataInput in) throws IOException, ClassNotFoundException { this.id = in.readInt(); this.name = in.readUTF(); this.birthday = DataSerializer.readDate(in); this.employer = (Company) DataSerializer.readObject(in); } }Instances of DataSerializerare used to data serialize objects (such as instances of standard Java classes or third-party classes for which the source code is not available) that do not implement theDataSerializableinterface.The following DataSerializerdata serializes instances ofCompany. In order for the data serialization framework to consult this custom serializer, it must be registered with the framework.public class CompanySerializer extends DataSerializer { static { DataSerializer.register(CompanySerializer.class); } /** May be invoked reflectively if instances of Company are distributed to other VMs. / public CompanySerializer() { } public Class[] getSupportedClasses() { return new Class[] { Company.class }; } public int getId() { return 42; } public boolean toData(Object o, DataOutput out) throws IOException { if (o instanceof Company) { Company company = (Company) o; out.writeUTF(company.getName()); // Let's assume that Address is java.io.Serializable Address address = company.getAddress(); writeObject(address, out); return true; } else { return false; } } public Object fromData(DataInput in) throws IOException, ClassNotFoundException { String name = in.readUTF(); Address address = (Address) readObject(in); return new Company(name, address); } }Just likeInstantiators, aDataSerializermay be sent to other members of the distributed system when it is registered. The data serialization framework does not require that aDataSerializerbeSerializable, but it does require that it provide a zero-argument constructor.- Since:
- GemFire 3.5
- See Also:
- writeObject(Object, DataOutput),- readObject(java.io.DataInput)
 
- 
- 
Field SummaryFields Modifier and Type Field Description protected static java.lang.ThreadLocal<java.lang.Boolean>DISALLOW_JAVA_SERIALIZATIONprotected static byteDOUBLEprotected static byteINTprotected static byteLONGprotected static bytePRESENTprotected static booleanTRACE_SERIALIZABLEDeprecated.Use Boolean.getBoolean("DataSerializer.TRACE_SERIALIZABLE") instead.
 - 
Constructor SummaryConstructors Constructor Description DataSerializer()Creates a newDataSerializer.
 - 
Method SummaryAll Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object o)TwoDataSerializers are consider to be equal if they have the same id and the same classabstract java.lang.ObjectfromData(java.io.DataInput in)Reads an object from aDataInput.java.lang.ObjectgetContext()For internal use only.java.lang.ObjectgetEventId()For internal use only.abstract intgetId()Returns the id of thisDataSerializer.abstract java.lang.Class<?>[]getSupportedClasses()Returns theClasses whose instances are data serialized by thisDataSerializer.inthashCode()static <E> java.util.ArrayList<E>readArrayList(java.io.DataInput in)Reads anArrayListfrom aDataInput.static byte[][]readArrayOfByteArrays(java.io.DataInput in)Reads an array ofbyte[]s from aDataInput.static java.lang.BooleanreadBoolean(java.io.DataInput in)Reads an instance ofBooleanfrom aDataInput.static boolean[]readBooleanArray(java.io.DataInput in)Reads an array ofbooleans from aDataInput.static java.lang.BytereadByte(java.io.DataInput in)Reads an instance ofBytefrom aDataInput.static byte[]readByteArray(java.io.DataInput in)Reads an array ofbytes from aDataInput.static java.lang.CharacterreadCharacter(java.io.DataInput in)Reads an instance ofCharacterfrom aDataInput.static char[]readCharArray(java.io.DataInput in)Reads an array ofchars from aDataInput.static java.lang.Class<?>readClass(java.io.DataInput in)Reads an instance ofClassfrom aDataInput.static <K,V>
 java.util.concurrent.ConcurrentHashMap<K,V>readConcurrentHashMap(java.io.DataInput in)Reads aConcurrentHashMapfrom aDataInput.static java.util.DatereadDate(java.io.DataInput in)Reads an instance ofDatefrom aDataInput.static java.lang.DoublereadDouble(java.io.DataInput in)Reads an instance ofDoublefrom aDataInput.static double[]readDoubleArray(java.io.DataInput in)Reads an array ofdoubles from aDataInput.static <E extends java.lang.Enum<E>>
 EreadEnum(java.lang.Class<E> clazz, java.io.DataInput in)Reads anEnum constantfromDataInput.static java.io.FilereadFile(java.io.DataInput in)Reads an instance ofFilefrom aDataInput.static java.lang.FloatreadFloat(java.io.DataInput in)Reads an instance ofFloatfrom aDataInput.static float[]readFloatArray(java.io.DataInput in)Reads an array offloats from aDataInput.static <K,V>
 java.util.HashMap<K,V>readHashMap(java.io.DataInput in)Reads aHashMapfrom aDataInput.static <E> java.util.HashSet<E>readHashSet(java.io.DataInput in)Reads aHashSetfrom aDataInput.static <K,V>
 java.util.Hashtable<K,V>readHashtable(java.io.DataInput in)Reads aHashtablefrom aDataInput.static <K,V>
 java.util.IdentityHashMap<K,V>readIdentityHashMap(java.io.DataInput in)Reads anIdentityHashMapfrom aDataInput.static java.net.InetAddressreadInetAddress(java.io.DataInput in)Reads an instance ofInetAddressfrom aDataInput.static int[]readIntArray(java.io.DataInput in)Reads anintarray from aDataInput.static java.lang.IntegerreadInteger(java.io.DataInput in)Reads an instance ofIntegerfrom aDataInput.static <K,V>
 java.util.LinkedHashMap<K,V>readLinkedHashMap(java.io.DataInput in)Reads aLinkedHashMapfrom aDataInput.static <E> java.util.LinkedHashSet<E>readLinkedHashSet(java.io.DataInput in)Reads aLinkedHashSetfrom aDataInput.static <E> java.util.LinkedList<E>readLinkedList(java.io.DataInput in)Reads aLinkedListfrom aDataInput.static java.lang.LongreadLong(java.io.DataInput in)Reads an instance ofLongfrom aDataInput.static long[]readLongArray(java.io.DataInput in)Reads an array oflongs from aDataInput.static java.lang.StringreadNonPrimitiveClassName(java.io.DataInput in)Reads name of an instance ofClassfrom aDataInput.static <T> TreadObject(java.io.DataInput in)Reads an arbitrary object from aDataInput.static java.lang.Object[]readObjectArray(java.io.DataInput in)Reads an array ofObjects from aDataInput.static <T> java.util.Optional<T>readOptional(java.io.DataInput in)Reads anOptionalfrom aDataInput.static java.util.OptionalDoublereadOptionalDouble(java.io.DataInput in)Reads anOptionalDoublefrom aDataInput.static java.util.OptionalIntreadOptionalInt(java.io.DataInput in)Reads anOptionalIntfrom aDataInput.static java.util.OptionalLongreadOptionalLong(java.io.DataInput in)Reads anOptionalLongfrom aDataInput.protected static <T> TreadOptionalPrimitive(java.io.DataInput in)static booleanreadPrimitiveBoolean(java.io.DataInput in)Reads a primitivebooleanfrom aDataInput.static bytereadPrimitiveByte(java.io.DataInput in)Reads a primitivebytefrom aDataInput.static charreadPrimitiveChar(java.io.DataInput in)Reads a primitivecharfrom aDataInput.static doublereadPrimitiveDouble(java.io.DataInput in)Reads a primitivedoublefrom aDataInput.static floatreadPrimitiveFloat(java.io.DataInput in)Reads a primitivefloatfrom aDataInput.static intreadPrimitiveInt(java.io.DataInput in)Reads a primitiveintfrom aDataInput.static longreadPrimitiveLong(java.io.DataInput in)Reads a primitivelongfrom aDataInput.static shortreadPrimitiveShort(java.io.DataInput in)Reads a primitiveshortfrom aDataInput.static java.util.PropertiesreadProperties(java.io.DataInput in)Reads aPropertiesfrom aDataInput.static <K,V>
 Region<K,V>readRegion(java.io.DataInput in)Reads an instance of Region.static java.lang.ShortreadShort(java.io.DataInput in)Reads an instance ofShortfrom aDataInput.static short[]readShortArray(java.io.DataInput in)Reads an array ofshorts from aDataInput.static <E> java.util.Stack<E>readStack(java.io.DataInput in)Reads aStackfrom aDataInput.static java.lang.StringreadString(java.io.DataInput in)Reads an instance ofStringfrom aDataInput.static java.lang.String[]readStringArray(java.io.DataInput in)Reads an array ofStrings from aDataInput.static <K,V>
 java.util.TreeMap<K,V>readTreeMap(java.io.DataInput in)Reads aTreeMapfrom aDataInput.static <E> java.util.TreeSet<E>readTreeSet(java.io.DataInput in)Reads aTreeSetfrom aDataInput.static intreadUnsignedByte(java.io.DataInput in)Reads a primitiveintas an unsigned byte from aDataInputusingDataInput.readUnsignedByte().static intreadUnsignedShort(java.io.DataInput in)Reads a primitiveintas an unsigned short from aDataInputusingDataInput.readUnsignedShort().static <E> java.util.Vector<E>readVector(java.io.DataInput in)Reads aVectorfrom aDataInput.static DataSerializerregister(java.lang.Class<?> c)Registers aDataSerializerclass with the data serialization framework.voidsetContext(java.lang.Object context)For internal use only.voidsetEventId(java.lang.Object eventId)For internal use only.abstract booleantoData(java.lang.Object o, java.io.DataOutput out)Data serializes an object to aDataOutput.static voidwriteArrayList(java.util.ArrayList<?> list, java.io.DataOutput out)Writes anArrayListto aDataOutput.static voidwriteArrayOfByteArrays(byte[][] array, java.io.DataOutput out)Writes an array ofbyte[]to aDataOutput.static voidwriteBoolean(java.lang.Boolean value, java.io.DataOutput out)Writes an instance ofBooleanto aDataOutput.static voidwriteBooleanArray(boolean[] array, java.io.DataOutput out)Writes an array ofbooleans to aDataOutput.static voidwriteByte(java.lang.Byte value, java.io.DataOutput out)Writes an instance ofByteto aDataOutput.static voidwriteByteArray(byte[] array, int len, java.io.DataOutput out)Writes the firstlenelements of an array ofbytes to aDataOutput.static voidwriteByteArray(byte[] array, java.io.DataOutput out)Writes an array ofbytes to aDataOutput.static voidwriteCharacter(java.lang.Character value, java.io.DataOutput out)Writes an instance ofCharacterto aDataOutput.static voidwriteCharArray(char[] array, java.io.DataOutput out)Writes an array ofchars to aDataOutput.static voidwriteClass(java.lang.Class<?> c, java.io.DataOutput out)Writes an instance ofClassto aDataOutput.static voidwriteConcurrentHashMap(java.util.concurrent.ConcurrentHashMap<?,?> map, java.io.DataOutput out)Writes aConcurrentHashMapto aDataOutput.static voidwriteDate(java.util.Date date, java.io.DataOutput out)Writes an instance ofDateto aDataOutput.static voidwriteDouble(java.lang.Double value, java.io.DataOutput out)Writes an instance ofDoubleto aDataOutput.static voidwriteDoubleArray(double[] array, java.io.DataOutput out)Writes an array ofdoubles to aDataOutput.static voidwriteEnum(java.lang.Enum<?> e, java.io.DataOutput out)Writes theEnum constanttoDataOutput.static voidwriteFile(java.io.File file, java.io.DataOutput out)Writes an instance ofFileto aDataOutput.static voidwriteFloat(java.lang.Float value, java.io.DataOutput out)Writes an instance ofFloatto aDataOutput.static voidwriteFloatArray(float[] array, java.io.DataOutput out)Writes an array offloats to aDataOutput.static voidwriteHashMap(java.util.Map<?,?> map, java.io.DataOutput out)Writes aHashMapto aDataOutput.static voidwriteHashSet(java.util.HashSet<?> set, java.io.DataOutput out)Writes aHashSetto aDataOutput.static voidwriteHashtable(java.util.Hashtable<?,?> map, java.io.DataOutput out)Writes aHashtableto aDataOutput.static voidwriteIdentityHashMap(java.util.IdentityHashMap<?,?> map, java.io.DataOutput out)Writes anIdentityHashMapto aDataOutput.static voidwriteInetAddress(java.net.InetAddress address, java.io.DataOutput out)Writes an instance ofInetAddressto aDataOutput.static voidwriteIntArray(int[] array, java.io.DataOutput out)Writes anintarray to aDataOutput.static voidwriteInteger(java.lang.Integer value, java.io.DataOutput out)Writes an instance ofIntegerto aDataOutput.static voidwriteLinkedHashMap(java.util.Map<?,?> map, java.io.DataOutput out)Writes aLinkedHashMapto aDataOutput.static voidwriteLinkedHashSet(java.util.LinkedHashSet<?> set, java.io.DataOutput out)Writes aLinkedHashSetto aDataOutput.static voidwriteLinkedList(java.util.LinkedList<?> list, java.io.DataOutput out)Writes aLinkedListto aDataOutput.static voidwriteLong(java.lang.Long value, java.io.DataOutput out)Writes an instance ofLongto aDataOutput.static voidwriteLongArray(long[] array, java.io.DataOutput out)Writes an array oflongs to aDataOutput.static voidwriteNonPrimitiveClassName(java.lang.String className, java.io.DataOutput out)Writes class name to aDataOutput.static voidwriteObject(java.lang.Object o, java.io.DataOutput out)Writes an arbitrary object to aDataOutputby callingwriteObject(Object, DataOutput, boolean)withtrue.static voidwriteObject(java.lang.Object o, java.io.DataOutput out, boolean allowJavaSerialization)Writes an arbitrary object to aDataOutputby serializing it into bytes.static voidwriteObjectArray(java.lang.Object[] array, java.io.DataOutput out)Writes an array ofObjects to aDataOutput.static voidwriteObjectAsByteArray(java.lang.Object obj, java.io.DataOutput out)Serialize the given objectobjinto a byte array usingwriteObject(Object, DataOutput)and then writes the byte array to the given data outputoutin the same formatwriteByteArray(byte[], DataOutput)does.static <T> voidwriteOptional(java.util.Optional<T> o, java.io.DataOutput out)Writes anOptionalto aDataOutput.static voidwriteOptionalDouble(java.util.OptionalDouble o, java.io.DataOutput out)Writes anOptionalDoubleto aDataOutput.static voidwriteOptionalInt(java.util.OptionalInt o, java.io.DataOutput out)Writes anOptionalIntto aDataOutput.static voidwriteOptionalLong(java.util.OptionalLong o, java.io.DataOutput out)Writes anOptionalLongto aDataOutput.static voidwritePrimitiveBoolean(boolean value, java.io.DataOutput out)Writes a primitivebooleanto aDataOutput.static voidwritePrimitiveByte(byte value, java.io.DataOutput out)Writes a primitivebyteto aDataOutput.static voidwritePrimitiveChar(char value, java.io.DataOutput out)Writes a primitivecharto aDataOutput.static voidwritePrimitiveDouble(double value, java.io.DataOutput out)Writes a primitivedoubleto aDataOutput.static voidwritePrimitiveFloat(float value, java.io.DataOutput out)Writes a primitivefloatto aDataOutput.static voidwritePrimitiveInt(int value, java.io.DataOutput out)Writes a primitiveintto aDataOutput.static voidwritePrimitiveLong(long value, java.io.DataOutput out)Writes a primitivelongto aDataOutput.static voidwritePrimitiveShort(short value, java.io.DataOutput out)Writes a primitiveshortto aDataOutput.static voidwriteProperties(java.util.Properties props, java.io.DataOutput out)Writes aPropertiesto aDataOutput.static voidwriteRegion(Region<?,?> rgn, java.io.DataOutput out)Writes an instance of Region.static voidwriteShort(java.lang.Short value, java.io.DataOutput out)Writes an instance ofShortto aDataOutput.static voidwriteShortArray(short[] array, java.io.DataOutput out)Writes an array ofshorts to aDataOutput.static voidwriteStack(java.util.Stack<?> list, java.io.DataOutput out)Writes aStackto aDataOutput.static voidwriteString(java.lang.String value, java.io.DataOutput out)Writes an instance ofStringto aDataOutput.static voidwriteStringArray(java.lang.String[] array, java.io.DataOutput out)Writes an array ofStrings to aDataOutput.static voidwriteTreeMap(java.util.TreeMap<?,?> map, java.io.DataOutput out)Writes aTreeMapto aDataOutput.static voidwriteTreeSet(java.util.TreeSet<?> set, java.io.DataOutput out)Writes aTreeSetto aDataOutput.static voidwriteUnsignedByte(int value, java.io.DataOutput out)Writes a primitiveintas an unsigned byte to aDataOutput.static voidwriteUnsignedShort(int value, java.io.DataOutput out)Writes a primitiveintas an unsigned short to aDataOutput.static voidwriteVector(java.util.Vector<?> list, java.io.DataOutput out)Writes aVectorto aDataOutput.
 
- 
- 
- 
Field Detail- 
PRESENTprotected static final byte PRESENT - See Also:
- Constant Field Values
 
 - 
INTprotected static final byte INT - See Also:
- Constant Field Values
 
 - 
LONGprotected static final byte LONG - See Also:
- Constant Field Values
 
 - 
DOUBLEprotected static final byte DOUBLE - See Also:
- Constant Field Values
 
 - 
TRACE_SERIALIZABLE@Deprecated protected static final boolean TRACE_SERIALIZABLE Deprecated.Use Boolean.getBoolean("DataSerializer.TRACE_SERIALIZABLE") instead.
 - 
DISALLOW_JAVA_SERIALIZATIONprotected static final java.lang.ThreadLocal<java.lang.Boolean> DISALLOW_JAVA_SERIALIZATION 
 
- 
 - 
Constructor Detail- 
DataSerializerpublic DataSerializer() Creates a newDataSerializer. All class that implementDataSerializermust provide a zero-argument constructor.- See Also:
- register(Class)
 
 
- 
 - 
Method Detail- 
writeClasspublic static void writeClass(java.lang.Class<?> c, java.io.DataOutput out) throws java.io.IOExceptionWrites an instance ofClassto aDataOutput. This method will handle anullvalue and not throw aNullPointerException.- Parameters:
- c- the- Classto write
- out- the- DataInputto write to
- Throws:
- java.io.IOException- A problem occurs while writing to- out
- See Also:
- readClass(java.io.DataInput)
 
 - 
writeNonPrimitiveClassNamepublic static void writeNonPrimitiveClassName(java.lang.String className, java.io.DataOutput out) throws java.io.IOExceptionWrites class name to aDataOutput. This method will handle anullvalue and not throw aNullPointerException.- Parameters:
- className- the class name to write
- out- the- DataInputto write to
- Throws:
- java.io.IOException- A problem occurs while writing to- out
- See Also:
- readNonPrimitiveClassName(DataInput)
 
 - 
readClasspublic static java.lang.Class<?> readClass(java.io.DataInput in) throws java.io.IOException, java.lang.ClassNotFoundExceptionReads an instance ofClassfrom aDataInput. The class will be loaded using the current content class loader. The return value may benull.- Parameters:
- in- the- DataInputto read from
- Returns:
- the deserialized Class
- Throws:
- java.io.IOException- A problem occurs while reading from- in
- java.lang.ClassNotFoundException- The class cannot be loaded
 
 - 
readNonPrimitiveClassNamepublic static java.lang.String readNonPrimitiveClassName(java.io.DataInput in) throws java.io.IOExceptionReads name of an instance ofClassfrom aDataInput. The return value may benull.- Parameters:
- in- the- DataInputto read from
- Returns:
- the deserialized Class name
- Throws:
- java.io.IOException- A problem occurs while reading from- in
- See Also:
- writeNonPrimitiveClassName(String, DataOutput)
 
 - 
writeRegionpublic static void writeRegion(Region<?,?> rgn, java.io.DataOutput out) throws java.io.IOException Writes an instance of Region. A Region is serialized as just a reference to a full path only. It will be recreated on the other end by callingCacheFactory.getAnyInstance()and then callinggetRegionon it. This method will handle anullvalue and not throw aNullPointerException.- Parameters:
- rgn- the Region to write
- out- the- DataInputto write to
- Throws:
- java.io.IOException- if a problem occurs while reading from- in
 
 - 
readRegionpublic static <K,V> Region<K,V> readRegion(java.io.DataInput in) throws java.io.IOException, java.lang.ClassNotFoundException Reads an instance of Region. A Region is serialized as a reference to a full path only. It is recreated on the other end by callingCacheFactory.getAnyInstance()and then callinggetRegionon it. The return value may benull.- Type Parameters:
- K- the type of keys in the region
- V- the type of values in the region
- Parameters:
- in- the input stream
- Returns:
- the Region instance
- Throws:
- CacheClosedException- if a cache has not been created or the only created one is closed.
- RegionNotFoundException- if there is no region by this name in the Cache. Since this exception is deprecated, please see- RegionNotFoundExceptionfor alternatives.
- java.io.IOException- if a problem occurs while reading from- in
- java.lang.ClassNotFoundException- if the class of one of the Region's elements cannot be found.
 
 - 
writeDatepublic static void writeDate(java.util.Date date, java.io.DataOutput out) throws java.io.IOExceptionWrites an instance ofDateto aDataOutput. Note that even thoughdatemay be an instance of a subclass ofDate,readDatewill always return an instance ofDate, not an instance of the subclass. To preserve the class type ofdate,\writeObject(Object, DataOutput)should be used for data serialization. This method will handle anullvalue and not throw aNullPointerException.- Parameters:
- date- the- Dateto write
- out- the- DataInputto write to
- Throws:
- java.io.IOException- A problem occurs while writing to- out
- See Also:
- readDate(java.io.DataInput)
 
 - 
readDatepublic static java.util.Date readDate(java.io.DataInput in) throws java.io.IOExceptionReads an instance ofDatefrom aDataInput. The return value may benull.- Parameters:
- in- the- DataInputto read from
- Returns:
- the deserialized Date
- Throws:
- java.io.IOException- A problem occurs while reading from- in
 
 - 
writeFilepublic static void writeFile(java.io.File file, java.io.DataOutput out) throws java.io.IOExceptionWrites an instance ofFileto aDataOutput. Note that even thoughfilemay be an instance of a subclass ofFile,readFilewill always return an instance ofFile, not an instance of the subclass. To preserve the class type offile,writeObject(Object, DataOutput)should be used for data serialization. This method will handle anullvalue and not throw aNullPointerException.- Parameters:
- file- the- Fileto write
- out- the- DataInputto write to
- Throws:
- java.io.IOException- A problem occurs while writing to- out
- See Also:
- readFile(java.io.DataInput),- File.getCanonicalPath()
 
 - 
readFilepublic static java.io.File readFile(java.io.DataInput in) throws java.io.IOExceptionReads an instance ofFilefrom aDataInput. The return value may benull.- Parameters:
- in- the- DataInputto read from
- Returns:
- the deserialized File
- Throws:
- java.io.IOException- A problem occurs while reading from- in
 
 - 
writeInetAddresspublic static void writeInetAddress(java.net.InetAddress address, java.io.DataOutput out) throws java.io.IOExceptionWrites an instance ofInetAddressto aDataOutput. TheInetAddressis data serialized by writing itsbyterepresentation to theDataOutput.readInetAddress(java.io.DataInput)converts thebyterepresentation to an instance ofInetAddressusingInetAddress.getAddress(). As a result, ifaddressis an instance of a user-defined subclass ofInetAddress(that is, not an instance of one of the subclasses from thejava.netpackage), its class will not be preserved. In order to be able to read an instance of the user-defined class,writeObject(Object, DataOutput)should be used. This method will handle anullvalue and not throw aNullPointerException.- Parameters:
- address- the- InetAddressto write
- out- the- DataInputto write to
- Throws:
- java.io.IOException- A problem occurs while writing to- out
- See Also:
- readInetAddress(java.io.DataInput)
 
 - 
readInetAddresspublic static java.net.InetAddress readInetAddress(java.io.DataInput in) throws java.io.IOExceptionReads an instance ofInetAddressfrom aDataInput. The return value may benull.- Parameters:
- in- the- DataInputto read from
- Returns:
- the deserialized InetAddress
- Throws:
- java.io.IOException- A problem occurs while reading from- inor the address read from- inis unknown
- See Also:
- InetAddress.getAddress()
 
 - 
writeStringpublic static void writeString(java.lang.String value, java.io.DataOutput out) throws java.io.IOExceptionWrites an instance ofStringto aDataOutput. This method will handle anullvalue and not throw aNullPointerException.As of 5.7 strings longer than 0xFFFF can be serialized. - Parameters:
- value- the- Stringto write
- out- the- DataInputto write to
- Throws:
- java.io.IOException- A problem occurs while writing to- out
- See Also:
- readString(java.io.DataInput)
 
 - 
readStringpublic static java.lang.String readString(java.io.DataInput in) throws java.io.IOExceptionReads an instance ofStringfrom aDataInput. The return value may benull.- Parameters:
- in- the- DataInputto read from
- Returns:
- the deserialized String
- Throws:
- java.io.IOException- A problem occurs while reading from- in
- See Also:
- writeString(java.lang.String, java.io.DataOutput)
 
 - 
writeBooleanpublic static void writeBoolean(java.lang.Boolean value, java.io.DataOutput out) throws java.io.IOExceptionWrites an instance ofBooleanto aDataOutput.- Parameters:
- value- the- Booleanto write
- out- the- DataInputto write to
- Throws:
- java.io.IOException- A problem occurs while writing to- out
- java.lang.NullPointerException- if value is null.
- See Also:
- readBoolean(java.io.DataInput)
 
 - 
readBooleanpublic static java.lang.Boolean readBoolean(java.io.DataInput in) throws java.io.IOExceptionReads an instance ofBooleanfrom aDataInput.- Parameters:
- in- the- DataInputto read from
- Returns:
- the deserialized Boolean
- Throws:
- java.io.IOException- A problem occurs while reading from- in
 
 - 
writeCharacterpublic static void writeCharacter(java.lang.Character value, java.io.DataOutput out) throws java.io.IOExceptionWrites an instance ofCharacterto aDataOutput.- Parameters:
- value- the- Characterto write
- out- the- DataInputto write to
- Throws:
- java.io.IOException- A problem occurs while writing to- out
- java.lang.NullPointerException- if value is null.
- See Also:
- readCharacter(java.io.DataInput)
 
 - 
readCharacterpublic static java.lang.Character readCharacter(java.io.DataInput in) throws java.io.IOExceptionReads an instance ofCharacterfrom aDataInput.- Parameters:
- in- the- DataInputto read from
- Returns:
- the deserialized Character
- Throws:
- java.io.IOException- A problem occurs while reading from- in
 
 - 
writeBytepublic static void writeByte(java.lang.Byte value, java.io.DataOutput out) throws java.io.IOExceptionWrites an instance ofByteto aDataOutput.- Parameters:
- value- the- Byteto write
- out- the- DataInputto write to
- Throws:
- java.io.IOException- A problem occurs while writing to- out
- java.lang.NullPointerException- if value is null.
- See Also:
- readByte(java.io.DataInput)
 
 - 
readBytepublic static java.lang.Byte readByte(java.io.DataInput in) throws java.io.IOExceptionReads an instance ofBytefrom aDataInput.- Parameters:
- in- the- DataInputto read from
- Returns:
- the deserialized Byte
- Throws:
- java.io.IOException- A problem occurs while reading from- in
 
 - 
writeShortpublic static void writeShort(java.lang.Short value, java.io.DataOutput out) throws java.io.IOExceptionWrites an instance ofShortto aDataOutput.- Parameters:
- value- the- Shortto write
- out- the- DataInputto write to
- Throws:
- java.io.IOException- A problem occurs while writing to- out
- java.lang.NullPointerException- if value is null.
- See Also:
- readShort(java.io.DataInput)
 
 - 
readShortpublic static java.lang.Short readShort(java.io.DataInput in) throws java.io.IOExceptionReads an instance ofShortfrom aDataInput.- Parameters:
- in- the- DataInputto read from
- Returns:
- the deserialized Short
- Throws:
- java.io.IOException- A problem occurs while reading from- in
 
 - 
writeIntegerpublic static void writeInteger(java.lang.Integer value, java.io.DataOutput out) throws java.io.IOExceptionWrites an instance ofIntegerto aDataOutput.- Parameters:
- value- the- Integerto write
- out- the- DataInputto write to
- Throws:
- java.io.IOException- A problem occurs while writing to- out
- java.lang.NullPointerException- if value is null.
- See Also:
- readInteger(java.io.DataInput)
 
 - 
readIntegerpublic static java.lang.Integer readInteger(java.io.DataInput in) throws java.io.IOExceptionReads an instance ofIntegerfrom aDataInput.- Parameters:
- in- the- DataInputto read from
- Returns:
- the deserialized Integer
- Throws:
- java.io.IOException- A problem occurs while reading from- in
 
 - 
writeLongpublic static void writeLong(java.lang.Long value, java.io.DataOutput out) throws java.io.IOExceptionWrites an instance ofLongto aDataOutput.- Parameters:
- value- the- Longto write
- out- the- DataInputto write to
- Throws:
- java.io.IOException- A problem occurs while writing to- out
- java.lang.NullPointerException- if value is null.
- See Also:
- readLong(java.io.DataInput)
 
 - 
readLongpublic static java.lang.Long readLong(java.io.DataInput in) throws java.io.IOExceptionReads an instance ofLongfrom aDataInput.- Parameters:
- in- the- DataInputto read from
- Returns:
- the deserialized Long
- Throws:
- java.io.IOException- A problem occurs while reading from- in
 
 - 
writeFloatpublic static void writeFloat(java.lang.Float value, java.io.DataOutput out) throws java.io.IOExceptionWrites an instance ofFloatto aDataOutput.- Parameters:
- value- the- Floatto write
- out- the- DataInputto write to
- Throws:
- java.io.IOException- A problem occurs while writing to- out
- java.lang.NullPointerException- if value is null.
- See Also:
- readFloat(java.io.DataInput)
 
 - 
readFloatpublic static java.lang.Float readFloat(java.io.DataInput in) throws java.io.IOExceptionReads an instance ofFloatfrom aDataInput.- Parameters:
- in- the- DataInputto read from
- Returns:
- the deserialized Float
- Throws:
- java.io.IOException- A problem occurs while reading from- in
 
 - 
writeDoublepublic static void writeDouble(java.lang.Double value, java.io.DataOutput out) throws java.io.IOExceptionWrites an instance ofDoubleto aDataOutput.- Parameters:
- value- the- Doubleto write
- out- the- DataInputto write to
- Throws:
- java.io.IOException- A problem occurs while writing to- out
- java.lang.NullPointerException- if value is null.
- See Also:
- readDouble(java.io.DataInput)
 
 - 
readDoublepublic static java.lang.Double readDouble(java.io.DataInput in) throws java.io.IOExceptionReads an instance ofDoublefrom aDataInput.- Parameters:
- in- the- DataInputto read from
- Returns:
- the deserialized Double
- Throws:
- java.io.IOException- A problem occurs while reading from- in
 
 - 
writePrimitiveBooleanpublic static void writePrimitiveBoolean(boolean value, java.io.DataOutput out) throws java.io.IOExceptionWrites a primitivebooleanto aDataOutput.- Parameters:
- value- the primitive- booleanto write
- out- the- DataInputto write to
- Throws:
- java.io.IOException- A problem occurs while writing to- out
- Since:
- GemFire 5.1
- See Also:
- DataOutput.writeBoolean(boolean)
 
 - 
readPrimitiveBooleanpublic static boolean readPrimitiveBoolean(java.io.DataInput in) throws java.io.IOExceptionReads a primitivebooleanfrom aDataInput.- Parameters:
- in- the- DataInputto read from
- Returns:
- the deserialized primitive boolean
- Throws:
- java.io.IOException- A problem occurs while reading from- in
- Since:
- GemFire 5.1
- See Also:
- DataInput.readBoolean()
 
 - 
writePrimitiveBytepublic static void writePrimitiveByte(byte value, java.io.DataOutput out) throws java.io.IOExceptionWrites a primitivebyteto aDataOutput.- Parameters:
- value- the primitive- byteto write
- out- the- DataInputto write to
- Throws:
- java.io.IOException- A problem occurs while writing to- out
- Since:
- GemFire 5.1
- See Also:
- DataOutput.writeByte(int)
 
 - 
readPrimitiveBytepublic static byte readPrimitiveByte(java.io.DataInput in) throws java.io.IOExceptionReads a primitivebytefrom aDataInput.- Parameters:
- in- the- DataInputto read from
- Returns:
- the deserialized primitive byte
- Throws:
- java.io.IOException- A problem occurs while reading from- in
- Since:
- GemFire 5.1
- See Also:
- DataInput.readByte()
 
 - 
writePrimitiveCharpublic static void writePrimitiveChar(char value, java.io.DataOutput out) throws java.io.IOExceptionWrites a primitivecharto aDataOutput.- Parameters:
- value- the primitive- charto write
- out- the- DataInputto write to
- Throws:
- java.io.IOException- A problem occurs while writing to- out
- Since:
- GemFire 5.1
- See Also:
- DataOutput.writeChar(int)
 
 - 
readPrimitiveCharpublic static char readPrimitiveChar(java.io.DataInput in) throws java.io.IOExceptionReads a primitivecharfrom aDataInput.- Parameters:
- in- the- DataInputto read from
- Returns:
- the deserialized primitive char
- Throws:
- java.io.IOException- A problem occurs while reading from- in
- Since:
- GemFire 5.1
- See Also:
- DataInput.readChar()
 
 - 
writePrimitiveShortpublic static void writePrimitiveShort(short value, java.io.DataOutput out) throws java.io.IOExceptionWrites a primitiveshortto aDataOutput.- Parameters:
- value- the primitive- shortto write
- out- the- DataInputto write to
- Throws:
- java.io.IOException- A problem occurs while writing to- out
- Since:
- GemFire 5.1
- See Also:
- DataOutput.writeShort(int)
 
 - 
readPrimitiveShortpublic static short readPrimitiveShort(java.io.DataInput in) throws java.io.IOExceptionReads a primitiveshortfrom aDataInput.- Parameters:
- in- the- DataInputto read from
- Returns:
- the deserialized primitive short
- Throws:
- java.io.IOException- A problem occurs while reading from- in
- Since:
- GemFire 5.1
- See Also:
- DataInput.readShort()
 
 - 
writeUnsignedBytepublic static void writeUnsignedByte(int value, java.io.DataOutput out) throws java.io.IOExceptionWrites a primitiveintas an unsigned byte to aDataOutput.- Parameters:
- value- the primitive- intas an unsigned byte to write
- out- the- DataInputto write to
- Throws:
- java.io.IOException- A problem occurs while writing to- out
- Since:
- GemFire 5.1
- See Also:
- DataOutput.writeByte(int),- DataInput.readUnsignedByte()
 
 - 
readUnsignedBytepublic static int readUnsignedByte(java.io.DataInput in) throws java.io.IOExceptionReads a primitiveintas an unsigned byte from aDataInputusingDataInput.readUnsignedByte().- Parameters:
- in- the- DataInputto read from
- Returns:
- the deserialized primitive intas an unsigned byte
- Throws:
- java.io.IOException- A problem occurs while reading from- in
- Since:
- GemFire 5.1
 
 - 
writeUnsignedShortpublic static void writeUnsignedShort(int value, java.io.DataOutput out) throws java.io.IOExceptionWrites a primitiveintas an unsigned short to aDataOutput.- Parameters:
- value- the primitive- intas an unsigned short to write
- out- the- DataInputto write to
- Throws:
- java.io.IOException- A problem occurs while writing to- out
- Since:
- GemFire 5.1
- See Also:
- DataOutput.writeShort(int),- DataInput.readUnsignedShort()
 
 - 
readUnsignedShortpublic static int readUnsignedShort(java.io.DataInput in) throws java.io.IOExceptionReads a primitiveintas an unsigned short from aDataInputusingDataInput.readUnsignedShort().- Parameters:
- in- the- DataInputto read from
- Returns:
- the deserialized primitive intas an unsigned short
- Throws:
- java.io.IOException- A problem occurs while reading from- in
- Since:
- GemFire 5.1
 
 - 
writePrimitiveIntpublic static void writePrimitiveInt(int value, java.io.DataOutput out) throws java.io.IOExceptionWrites a primitiveintto aDataOutput.- Parameters:
- value- the primitive- intto write
- out- the- DataOutputto write to
- Throws:
- java.io.IOException- A problem occurs while writing to- out
- See Also:
- DataOutput.writeInt(int)
 
 - 
readPrimitiveIntpublic static int readPrimitiveInt(java.io.DataInput in) throws java.io.IOExceptionReads a primitiveintfrom aDataInput.- Parameters:
- in- the- DataInputto read from
- Returns:
- a primitive int
- Throws:
- java.io.IOException- A problem occurs while reading from- in
- Since:
- GemFire 5.1
- See Also:
- DataInput.readInt()
 
 - 
writePrimitiveLongpublic static void writePrimitiveLong(long value, java.io.DataOutput out) throws java.io.IOExceptionWrites a primitivelongto aDataOutput.- Parameters:
- value- the primitive- longto write
- out- the- DataOutputto write to
- Throws:
- java.io.IOException- A problem occurs while writing to- out
- Since:
- GemFire 5.1
- See Also:
- DataOutput.writeLong(long)
 
 - 
readPrimitiveLongpublic static long readPrimitiveLong(java.io.DataInput in) throws java.io.IOExceptionReads a primitivelongfrom aDataInput.- Parameters:
- in- the- DataInputto read from
- Returns:
- a primitive long
- Throws:
- java.io.IOException- A problem occurs while reading from- in
- Since:
- GemFire 5.1
- See Also:
- DataInput.readLong()
 
 - 
writePrimitiveFloatpublic static void writePrimitiveFloat(float value, java.io.DataOutput out) throws java.io.IOExceptionWrites a primitivefloatto aDataOutput.- Parameters:
- value- the primitive- floatto write
- out- the- DataOutputto write to
- Throws:
- java.io.IOException- A problem occurs while writing to- out
- Since:
- GemFire 5.1
- See Also:
- DataOutput.writeFloat(float)
 
 - 
readPrimitiveFloatpublic static float readPrimitiveFloat(java.io.DataInput in) throws java.io.IOExceptionReads a primitivefloatfrom aDataInput.- Parameters:
- in- the- DataInputto read from
- Returns:
- a primitive float
- Throws:
- java.io.IOException- A problem occurs while reading from- in
- Since:
- GemFire 5.1
- See Also:
- DataInput.readFloat()
 
 - 
writePrimitiveDoublepublic static void writePrimitiveDouble(double value, java.io.DataOutput out) throws java.io.IOExceptionWrites a primitivedoubleto aDataOutput.- Parameters:
- value- the primitive- doubleto write
- out- the- DataOutputto write to
- Throws:
- java.io.IOException- A problem occurs while writing to- out
- Since:
- GemFire 5.1
- See Also:
- DataOutput.writeDouble(double)
 
 - 
readPrimitiveDoublepublic static double readPrimitiveDouble(java.io.DataInput in) throws java.io.IOExceptionReads a primitivedoublefrom aDataInput.- Parameters:
- in- the- DataInputto read from
- Returns:
- a primitive double
- Throws:
- java.io.IOException- A problem occurs while reading from- in
- Since:
- GemFire 5.1
- See Also:
- DataInput.readDouble()
 
 - 
writeByteArraypublic static void writeByteArray(byte[] array, java.io.DataOutput out) throws java.io.IOExceptionWrites an array ofbytes to aDataOutput. This method will serialize anullarray and not throw aNullPointerException.- Parameters:
- array- the array of- bytes to write
- out- the- DataOutputto write to
- Throws:
- java.io.IOException- A problem occurs while writing to- out
- See Also:
- readByteArray(java.io.DataInput)
 
 - 
writeByteArraypublic static void writeByteArray(byte[] array, int len, java.io.DataOutput out) throws java.io.IOExceptionWrites the firstlenelements of an array ofbytes to aDataOutput. This method will serialize anullarray and not throw aNullPointerException.- Parameters:
- array- the array of- bytes to write
- len- the actual number of entries to write. If len is greater than then length of the
- out- the- DataOutputto write to array then the entire array is written.
- Throws:
- java.io.IOException- A problem occurs while writing to- out
- See Also:
- readByteArray(java.io.DataInput)
 
 - 
writeObjectAsByteArraypublic static void writeObjectAsByteArray(java.lang.Object obj, java.io.DataOutput out) throws java.io.IOExceptionSerialize the given objectobjinto a byte array usingwriteObject(Object, DataOutput)and then writes the byte array to the given data outputoutin the same formatwriteByteArray(byte[], DataOutput)does. This method will serialize anullobj and not throw aNullPointerException.- Parameters:
- obj- the object to serialize and write
- out- the data output to write the byte array to
- Throws:
- java.lang.IllegalArgumentException- if a problem occurs while serialize- obj
- java.io.IOException- if a problem occurs while writing to- out
- Since:
- GemFire 5.0.2
- See Also:
- readByteArray(java.io.DataInput)
 
 - 
readByteArraypublic static byte[] readByteArray(java.io.DataInput in) throws java.io.IOExceptionReads an array ofbytes from aDataInput.- Parameters:
- in- the- DataInputto read from
- Returns:
- the deserialized array of bytes
- Throws:
- java.io.IOException- A problem occurs while reading from- in
- See Also:
- writeByteArray(byte[], DataOutput)
 
 - 
writeStringArraypublic static void writeStringArray(java.lang.String[] array, java.io.DataOutput out) throws java.io.IOExceptionWrites an array ofStrings to aDataOutput. This method will serialize anullarray and not throw aNullPointerException.- Parameters:
- array- the array of- Strings to write
- out- the- DataInputto write to
- Throws:
- java.io.IOException- A problem occurs while writing to- out
- See Also:
- readStringArray(java.io.DataInput),- writeString(java.lang.String, java.io.DataOutput)
 
 - 
readStringArraypublic static java.lang.String[] readStringArray(java.io.DataInput in) throws java.io.IOExceptionReads an array ofStrings from aDataInput.- Parameters:
- in- the- DataInputto read from
- Returns:
- the deserialized array of Strings
- Throws:
- java.io.IOException- A problem occurs while reading from- in
- See Also:
- writeStringArray(java.lang.String[], java.io.DataOutput)
 
 - 
writeShortArraypublic static void writeShortArray(short[] array, java.io.DataOutput out) throws java.io.IOExceptionWrites an array ofshorts to aDataOutput. This method will serialize anullarray and not throw aNullPointerException.- Parameters:
- array- the array of- shorts to write
- out- the- DataInputto write to
- Throws:
- java.io.IOException- A problem occurs while writing to- out
- See Also:
- readShortArray(java.io.DataInput)
 
 - 
readShortArraypublic static short[] readShortArray(java.io.DataInput in) throws java.io.IOExceptionReads an array ofshorts from aDataInput.- Parameters:
- in- the- DataInputto read from
- Returns:
- the deserialized array of shorts
- Throws:
- java.io.IOException- A problem occurs while reading from- in
- See Also:
- writeShortArray(short[], java.io.DataOutput)
 
 - 
writeCharArraypublic static void writeCharArray(char[] array, java.io.DataOutput out) throws java.io.IOExceptionWrites an array ofchars to aDataOutput.- Parameters:
- array- the array of- chars to write
- out- the- DataInputto write to
- Throws:
- java.io.IOException- A problem occurs while writing to- out
- Since:
- GemFire 5.7
- See Also:
- readCharArray(java.io.DataInput)
 
 - 
readCharArraypublic static char[] readCharArray(java.io.DataInput in) throws java.io.IOExceptionReads an array ofchars from aDataInput.- Parameters:
- in- the- DataInputto read from
- Returns:
- the deserialized array of chars
- Throws:
- java.io.IOException- A problem occurs while reading from- in
- Since:
- GemFire 5.7
- See Also:
- writeCharArray(char[], java.io.DataOutput)
 
 - 
writeBooleanArraypublic static void writeBooleanArray(boolean[] array, java.io.DataOutput out) throws java.io.IOExceptionWrites an array ofbooleans to aDataOutput.- Parameters:
- array- the array of- booleans to write
- out- the- DataInputto write to
- Throws:
- java.io.IOException- A problem occurs while writing to- out
- Since:
- GemFire 5.7
- See Also:
- readBooleanArray(java.io.DataInput)
 
 - 
readBooleanArraypublic static boolean[] readBooleanArray(java.io.DataInput in) throws java.io.IOExceptionReads an array ofbooleans from aDataInput.- Parameters:
- in- the- DataInputto read from
- Returns:
- the deserialized array of booleans
- Throws:
- java.io.IOException- A problem occurs while reading from- in
- Since:
- GemFire 5.7
- See Also:
- writeBooleanArray(boolean[], java.io.DataOutput)
 
 - 
writeIntArraypublic static void writeIntArray(int[] array, java.io.DataOutput out) throws java.io.IOExceptionWrites anintarray to aDataOutput. This method will serialize anullarray and not throw aNullPointerException.- Parameters:
- array- the array of- ints to write
- out- the- DataInputto write to
- Throws:
- java.io.IOException- A problem occurs while writing to- out
- See Also:
- readIntArray(java.io.DataInput)
 
 - 
readIntArraypublic static int[] readIntArray(java.io.DataInput in) throws java.io.IOExceptionReads anintarray from aDataInput.- Parameters:
- in- the- DataInputto read from
- Returns:
- the deserialized array of ints
- Throws:
- java.io.IOException- A problem occurs while reading from- in
- See Also:
- writeIntArray(int[], java.io.DataOutput)
 
 - 
writeLongArraypublic static void writeLongArray(long[] array, java.io.DataOutput out) throws java.io.IOExceptionWrites an array oflongs to aDataOutput. This method will serialize anullarray and not throw aNullPointerException.- Parameters:
- array- the array of- longs to write
- out- the- DataInputto write to
- Throws:
- java.io.IOException- A problem occurs while writing to- out
- See Also:
- readLongArray(java.io.DataInput)
 
 - 
readLongArraypublic static long[] readLongArray(java.io.DataInput in) throws java.io.IOExceptionReads an array oflongs from aDataInput.- Parameters:
- in- the- DataInputto read from
- Returns:
- the deserialized array of longs
- Throws:
- java.io.IOException- A problem occurs while reading from- in
- See Also:
- writeLongArray(long[], java.io.DataOutput)
 
 - 
writeFloatArraypublic static void writeFloatArray(float[] array, java.io.DataOutput out) throws java.io.IOExceptionWrites an array offloats to aDataOutput. This method will serialize anullarray and not throw aNullPointerException.- Parameters:
- array- the array of- floats to write
- out- the- DataInputto write to
- Throws:
- java.io.IOException- A problem occurs while writing to- out
- See Also:
- readFloatArray(java.io.DataInput)
 
 - 
readFloatArraypublic static float[] readFloatArray(java.io.DataInput in) throws java.io.IOExceptionReads an array offloats from aDataInput.- Parameters:
- in- the- DataInputto read from
- Returns:
- the deserialized array of floats
- Throws:
- java.io.IOException- A problem occurs while reading from- in
- See Also:
- writeFloatArray(float[], java.io.DataOutput)
 
 - 
writeDoubleArraypublic static void writeDoubleArray(double[] array, java.io.DataOutput out) throws java.io.IOExceptionWrites an array ofdoubles to aDataOutput. This method will serialize anullarray and not throw aNullPointerException.- Parameters:
- array- the array of- doubles to write
- out- the- DataInputto write to
- Throws:
- java.io.IOException- A problem occurs while writing to- out
- See Also:
- readDoubleArray(java.io.DataInput)
 
 - 
readDoubleArraypublic static double[] readDoubleArray(java.io.DataInput in) throws java.io.IOExceptionReads an array ofdoubles from aDataInput.- Parameters:
- in- the- DataInputto read from
- Returns:
- the deserialized array of doubles
- Throws:
- java.io.IOException- A problem occurs while reading from- in
- See Also:
- writeDoubleArray(double[], java.io.DataOutput)
 
 - 
writeObjectArraypublic static void writeObjectArray(java.lang.Object[] array, java.io.DataOutput out) throws java.io.IOExceptionWrites an array ofObjects to aDataOutput. This method will serialize anullarray and not throw aNullPointerException.- Parameters:
- array- the array of- Objects to write
- out- the- DataInputto write to
- Throws:
- java.io.IOException- A problem occurs while writing to- out
- See Also:
- readObjectArray(java.io.DataInput),- writeObject(Object, DataOutput)
 
 - 
readObjectArraypublic static java.lang.Object[] readObjectArray(java.io.DataInput in) throws java.io.IOException, java.lang.ClassNotFoundExceptionReads an array ofObjects from aDataInput.- Parameters:
- in- the- DataInputto read from
- Returns:
- the deserialized array of Objects
- Throws:
- java.io.IOException- A problem occurs while reading from- in
- java.lang.ClassNotFoundException- if the class of one of the array's elements cannot be found.
- See Also:
- writeObjectArray(java.lang.Object[], java.io.DataOutput),- readObject(java.io.DataInput)
 
 - 
writeArrayOfByteArrayspublic static void writeArrayOfByteArrays(byte[][] array, java.io.DataOutput out) throws java.io.IOExceptionWrites an array ofbyte[]to aDataOutput.- Parameters:
- array- the array of- byte[]s to write
- out- the- DataInputto write to
- Throws:
- java.io.IOException- A problem occurs while writing to- out.
 
 - 
readArrayOfByteArrayspublic static byte[][] readArrayOfByteArrays(java.io.DataInput in) throws java.io.IOExceptionReads an array ofbyte[]s from aDataInput.- Parameters:
- in- the- DataInputto read from
- Returns:
- the deserialized array of byte[]s
- Throws:
- java.io.IOException- A problem occurs while reading from- in
 
 - 
writeArrayListpublic static void writeArrayList(java.util.ArrayList<?> list, java.io.DataOutput out) throws java.io.IOExceptionWrites anArrayListto aDataOutput. Note that even thoughlistmay be an instance of a subclass ofArrayList,readArrayListwill always return an instance ofArrayList, not an instance of the subclass. To preserve the class type oflist,writeObject(Object, DataOutput)should be used for data serialization. This method will serialize anulllist and not throw aNullPointerException.- Parameters:
- list- the- ArrayListto write
- out- the- DataInputto write to
- Throws:
- java.io.IOException- A problem occurs while writing to- out
- See Also:
- readArrayList(java.io.DataInput)
 
 - 
readArrayListpublic static <E> java.util.ArrayList<E> readArrayList(java.io.DataInput in) throws java.io.IOException, java.lang.ClassNotFoundExceptionReads anArrayListfrom aDataInput.- Type Parameters:
- E- – the type of elements in the list
- Parameters:
- in- the- DataInputto read from
- Returns:
- the deserialized ArrayList
- Throws:
- java.io.IOException- A problem occurs while reading from- in
- java.lang.ClassNotFoundException- The class of one of the- ArrayList's elements cannot be found.
- See Also:
- writeArrayList(java.util.ArrayList<?>, java.io.DataOutput)
 
 - 
writeVectorpublic static void writeVector(java.util.Vector<?> list, java.io.DataOutput out) throws java.io.IOExceptionWrites aVectorto aDataOutput. Note that even thoughlistmay be an instance of a subclass ofVector,readVectorwill always return an instance ofVector, not an instance of the subclass. To preserve the class type oflist,writeObject(Object, DataOutput)should be used for data serialization.- Parameters:
- list- the- Vectorto write
- out- the- DataOutputto write to
- Throws:
- java.io.IOException- A problem occurs while writing to- out
- Since:
- GemFire 5.7
- See Also:
- readVector(java.io.DataInput)
 
 - 
readVectorpublic static <E> java.util.Vector<E> readVector(java.io.DataInput in) throws java.io.IOException, java.lang.ClassNotFoundExceptionReads aVectorfrom aDataInput.- Type Parameters:
- E- – the type of elements in the vector
- Parameters:
- in- the- DataInputto read from
- Returns:
- the deserialized Vector
- Throws:
- java.io.IOException- A problem occurs while reading from- in
- java.lang.ClassNotFoundException- The class of one of the- Vector's elements cannot be found.
- Since:
- GemFire 5.7
- See Also:
- writeVector(java.util.Vector<?>, java.io.DataOutput)
 
 - 
writeStackpublic static void writeStack(java.util.Stack<?> list, java.io.DataOutput out) throws java.io.IOExceptionWrites aStackto aDataOutput. Note that even thoughlistmay be an instance of a subclass ofStack,readStackwill always return an instance ofStack, not an instance of the subclass. To preserve the class type oflist,writeObject(Object, DataOutput)should be used for data serialization.- Parameters:
- list- the- Stackto write
- out- the- DataInputto write to
- Throws:
- java.io.IOException- A problem occurs while writing to- out
- Since:
- GemFire 5.7
- See Also:
- readStack(java.io.DataInput)
 
 - 
readStackpublic static <E> java.util.Stack<E> readStack(java.io.DataInput in) throws java.io.IOException, java.lang.ClassNotFoundExceptionReads aStackfrom aDataInput.- Type Parameters:
- E- – the type of elements in the stack
- Parameters:
- in- the- DataInputto read from
- Returns:
- the deserialized Stack
- Throws:
- java.io.IOException- A problem occurs while reading from- in
- java.lang.ClassNotFoundException- The class of one of the- Stack's elements cannot be found.
- Since:
- GemFire 5.7
- See Also:
- writeStack(java.util.Stack<?>, java.io.DataOutput)
 
 - 
writeLinkedListpublic static void writeLinkedList(java.util.LinkedList<?> list, java.io.DataOutput out) throws java.io.IOExceptionWrites aLinkedListto aDataOutput. Note that even thoughlistmay be an instance of a subclass ofLinkedList,readLinkedListwill always return an instance ofLinkedList, not an instance of the subclass. To preserve the class type oflist,writeObject(Object, DataOutput)should be used for data serialization. This method will serialize anulllist and not throw aNullPointerException.- Parameters:
- list- the- LinkedListto write
- out- the- DataInputto write to
- Throws:
- java.io.IOException- A problem occurs while writing to- out
- See Also:
- readLinkedList(java.io.DataInput)
 
 - 
readLinkedListpublic static <E> java.util.LinkedList<E> readLinkedList(java.io.DataInput in) throws java.io.IOException, java.lang.ClassNotFoundExceptionReads aLinkedListfrom aDataInput.- Type Parameters:
- E- – the type of elements in the list
- Parameters:
- in- the- DataInputto read from
- Returns:
- the deserialized LinkedList
- Throws:
- java.io.IOException- A problem occurs while reading from- in
- java.lang.ClassNotFoundException- The class of one of the- LinkedList's elements cannot be found.
- See Also:
- writeLinkedList(java.util.LinkedList<?>, java.io.DataOutput)
 
 - 
writeHashSetpublic static void writeHashSet(java.util.HashSet<?> set, java.io.DataOutput out) throws java.io.IOExceptionWrites aHashSetto aDataOutput. Note that even thoughsetmay be an instance of a subclass ofHashSet,readHashSetwill always return an instance ofHashSet, not an instance of the subclass. To preserve the class type ofset,writeObject(Object, DataOutput)should be used for data serialization. This method will serialize anullset and not throw aNullPointerException.- Parameters:
- set- the- HashSetto write
- out- the- DataInputto write to
- Throws:
- java.io.IOException- A problem occurs while writing to- out
- See Also:
- readHashSet(java.io.DataInput)
 
 - 
readHashSetpublic static <E> java.util.HashSet<E> readHashSet(java.io.DataInput in) throws java.io.IOException, java.lang.ClassNotFoundExceptionReads aHashSetfrom aDataInput.- Type Parameters:
- E- – the type of elements in the set
- Parameters:
- in- the- DataInputto read from
- Returns:
- the deserialized HashSet
- Throws:
- java.io.IOException- A problem occurs while reading from- in
- java.lang.ClassNotFoundException- The class of one of the- HashSet's elements cannot be found.
- See Also:
- writeHashSet(java.util.HashSet<?>, java.io.DataOutput)
 
 - 
writeLinkedHashSetpublic static void writeLinkedHashSet(java.util.LinkedHashSet<?> set, java.io.DataOutput out) throws java.io.IOExceptionWrites aLinkedHashSetto aDataOutput. Note that even thoughsetmay be an instance of a subclass ofLinkedHashSet,readLinkedHashSetwill always return an instance ofLinkedHashSet, not an instance of the subclass. To preserve the class type ofset,writeObject(Object, DataOutput)should be used for data serialization.- Parameters:
- set- the- LinkedHashSetto write
- out- the- DataInputto write to
- Throws:
- java.io.IOException- A problem occurs while writing to- out
- Since:
- GemFire 5.7
- See Also:
- readLinkedHashSet(java.io.DataInput)
 
 - 
readLinkedHashSetpublic static <E> java.util.LinkedHashSet<E> readLinkedHashSet(java.io.DataInput in) throws java.io.IOException, java.lang.ClassNotFoundExceptionReads aLinkedHashSetfrom aDataInput.- Type Parameters:
- E- – the type of elements in the set
- Parameters:
- in- the- DataInputto read from
- Returns:
- the deserialized LinkedHashSet
- Throws:
- java.io.IOException- A problem occurs while reading from- in
- java.lang.ClassNotFoundException- The class of one of the- LinkedHashSet's elements cannot be found.
- Since:
- GemFire 5.7
- See Also:
- writeLinkedHashSet(java.util.LinkedHashSet<?>, java.io.DataOutput)
 
 - 
writeHashMappublic static void writeHashMap(java.util.Map<?,?> map, java.io.DataOutput out) throws java.io.IOExceptionWrites aHashMapto aDataOutput. Note that even thoughmapmay be an instance of a subclass ofHashMap,readHashMapwill always return an instance ofHashMap, not an instance of the subclass. To preserve the class type ofmap,writeObject(Object, DataOutput)should be used for data serialization. This method will serialize anullmap and not throw aNullPointerException.- Parameters:
- map- the- HashMapto write
- out- the- DataInputto write to
- Throws:
- java.io.IOException- A problem occurs while writing to- out
- See Also:
- readHashMap(java.io.DataInput)
 
 - 
readHashMappublic static <K,V> java.util.HashMap<K,V> readHashMap(java.io.DataInput in) throws java.io.IOException, java.lang.ClassNotFoundExceptionReads aHashMapfrom aDataInput.- Type Parameters:
- K- – the type of keys in the map
- V- – the type of mapped values
- Parameters:
- in- the- DataInputto read from
- Returns:
- the deserialized HashMap
- Throws:
- java.io.IOException- A problem occurs while reading from- in
- java.lang.ClassNotFoundException- The class of one of the- HashMap's elements cannot be found.
- See Also:
- writeHashMap(java.util.Map<?, ?>, java.io.DataOutput)
 
 - 
writeIdentityHashMappublic static void writeIdentityHashMap(java.util.IdentityHashMap<?,?> map, java.io.DataOutput out) throws java.io.IOExceptionWrites anIdentityHashMapto aDataOutput. Note that even thoughmapmay be an instance of a subclass ofIdentityHashMap,readIdentityHashMapwill always return an instance ofIdentityHashMap, not an instance of the subclass. To preserve the class type ofmap,writeObject(Object, DataOutput)should be used for data serialization.- Parameters:
- map- the- IdentityHashMapto write
- out- the- DataInputto write to
- Throws:
- java.io.IOException- A problem occurs while writing to- out
- See Also:
- readIdentityHashMap(java.io.DataInput)
 
 - 
readIdentityHashMappublic static <K,V> java.util.IdentityHashMap<K,V> readIdentityHashMap(java.io.DataInput in) throws java.io.IOException, java.lang.ClassNotFoundExceptionReads anIdentityHashMapfrom aDataInput. Note that key identity is not preserved unless the keys belong to a class whose serialization preserves identity.- Type Parameters:
- K- – the type of keys in the map
- V- – the type of mapped values
- Parameters:
- in- the- DataInputto read from
- Returns:
- the deserialized IdentityHashMap
- Throws:
- java.io.IOException- A problem occurs while reading from- in
- java.lang.ClassNotFoundException- The class of one of the- IdentityHashMap's elements cannot be found.
- See Also:
- writeIdentityHashMap(java.util.IdentityHashMap<?, ?>, java.io.DataOutput)
 
 - 
writeConcurrentHashMappublic static void writeConcurrentHashMap(java.util.concurrent.ConcurrentHashMap<?,?> map, java.io.DataOutput out) throws java.io.IOExceptionWrites aConcurrentHashMapto aDataOutput. Note that even thoughmapmay be an instance of a subclass ofConcurrentHashMap,readConcurrentHashMapwill always return an instance ofConcurrentHashMap, not an instance of the subclass. To preserve the class type ofmap,writeObject(Object, DataOutput)should be used for data serialization.At this time if writeObject(Object, DataOutput)is called with an instance of ConcurrentHashMap then it will be serialized with normal java.io Serialization. So if you want the keys and values of a ConcurrentHashMap to take advantage of GemFire serialization it must be serialized with this method.- Parameters:
- map- the- ConcurrentHashMapto write
- out- the- DataInputto write to
- Throws:
- java.io.IOException- A problem occurs while writing to- out
- Since:
- GemFire 6.6
- See Also:
- readConcurrentHashMap(java.io.DataInput)
 
 - 
readConcurrentHashMappublic static <K,V> java.util.concurrent.ConcurrentHashMap<K,V> readConcurrentHashMap(java.io.DataInput in) throws java.io.IOException, java.lang.ClassNotFoundExceptionReads aConcurrentHashMapfrom aDataInput.- Type Parameters:
- K- – the type of keys in the map
- V- – the type of mapped values
- Parameters:
- in- the- DataInputto read from
- Returns:
- the deserialized ConcurrentHashMap
- Throws:
- java.io.IOException- A problem occurs while reading from- in
- java.lang.ClassNotFoundException- The class of one of the- ConcurrentHashMap's elements cannot be found.
- Since:
- GemFire 6.6
- See Also:
- writeConcurrentHashMap(java.util.concurrent.ConcurrentHashMap<?, ?>, java.io.DataOutput)
 
 - 
writeHashtablepublic static void writeHashtable(java.util.Hashtable<?,?> map, java.io.DataOutput out) throws java.io.IOExceptionWrites aHashtableto aDataOutput. Note that even thoughmapmay be an instance of a subclass ofHashtable,readHashtablewill always return an instance ofHashtable, not an instance of the subclass. To preserve the class type ofmap,writeObject(Object, DataOutput)should be used for data serialization.- Parameters:
- map- the- Hashtableto write
- out- the- DataInputto write to
- Throws:
- java.io.IOException- A problem occurs while writing to- out
- Since:
- GemFire 5.7
- See Also:
- readHashtable(java.io.DataInput)
 
 - 
readHashtablepublic static <K,V> java.util.Hashtable<K,V> readHashtable(java.io.DataInput in) throws java.io.IOException, java.lang.ClassNotFoundExceptionReads aHashtablefrom aDataInput.- Type Parameters:
- K- – the type of keys in the hashtable
- V- – the type of values in the hashtable
- Parameters:
- in- the- DataInputto read from
- Returns:
- the deserialized Hashtable
- Throws:
- java.io.IOException- A problem occurs while reading from- in
- java.lang.ClassNotFoundException- The class of one of the- Hashtable's elements cannot be found.
- Since:
- GemFire 5.7
- See Also:
- writeHashtable(java.util.Hashtable<?, ?>, java.io.DataOutput)
 
 - 
writeTreeMappublic static void writeTreeMap(java.util.TreeMap<?,?> map, java.io.DataOutput out) throws java.io.IOExceptionWrites aTreeMapto aDataOutput. Note that even thoughmapmay be an instance of a subclass ofTreeMap,readTreeMapwill always return an instance ofTreeMap, not an instance of the subclass. To preserve the class type ofmap,writeObject(Object, DataOutput)should be used for data serialization.If the map has a comparator then it must also be serializable. - Parameters:
- map- the- TreeMapto write
- out- the- DataInputto write to
- Throws:
- java.io.IOException- A problem occurs while writing to- out
- Since:
- GemFire 5.7
- See Also:
- readTreeMap(java.io.DataInput)
 
 - 
readTreeMappublic static <K,V> java.util.TreeMap<K,V> readTreeMap(java.io.DataInput in) throws java.io.IOException, java.lang.ClassNotFoundExceptionReads aTreeMapfrom aDataInput.- Type Parameters:
- K- – the type of keys in the map
- V- – the type of mapped values
- Parameters:
- in- the- DataInputto read from
- Returns:
- the deserialized TreeMap
- Throws:
- java.io.IOException- A problem occurs while reading from- in
- java.lang.ClassNotFoundException- The class of one of the- TreeMap's elements cannot be found.
- Since:
- GemFire 5.7
- See Also:
- writeTreeMap(java.util.TreeMap<?, ?>, java.io.DataOutput)
 
 - 
writeLinkedHashMappublic static void writeLinkedHashMap(java.util.Map<?,?> map, java.io.DataOutput out) throws java.io.IOExceptionWrites aLinkedHashMapto aDataOutput. Note that even thoughmapmay be an instance of a subclass ofLinkedHashMap,readLinkedHashMapwill always return an instance ofLinkedHashMap, not an instance of the subclass. To preserve the class type ofmap,writeObject(Object, DataOutput)should be used for data serialization. This method will serialize anullmap and not throw aNullPointerException.- Parameters:
- map- the- LinkedHashMapto write
- out- the- DataInputto write to
- Throws:
- java.io.IOException- A problem occurs while writing to- out
- See Also:
- readLinkedHashMap(java.io.DataInput)
 
 - 
readLinkedHashMappublic static <K,V> java.util.LinkedHashMap<K,V> readLinkedHashMap(java.io.DataInput in) throws java.io.IOException, java.lang.ClassNotFoundExceptionReads aLinkedHashMapfrom aDataInput.- Type Parameters:
- K- – the type of keys in the map
- V- – the type of mapped values
- Parameters:
- in- the- DataInputto read from
- Returns:
- the deserialized LinkedHashMap
- Throws:
- java.io.IOException- A problem occurs while reading from- in
- java.lang.ClassNotFoundException- The class of one of the- HashMap's elements cannot be found.
- See Also:
- writeLinkedHashMap(java.util.Map<?, ?>, java.io.DataOutput)
 
 - 
writeTreeSetpublic static void writeTreeSet(java.util.TreeSet<?> set, java.io.DataOutput out) throws java.io.IOExceptionWrites aTreeSetto aDataOutput. Note that even thoughsetmay be an instance of a subclass ofTreeSet,readTreeSetwill always return an instance ofTreeSet, not an instance of the subclass. To preserve the class type ofset,writeObject(Object, DataOutput)should be used for data serialization.If the set has a comparator then it must also be serializable. - Parameters:
- set- the- TreeSetto write
- out- the- DataInputto write to
- Throws:
- java.io.IOException- A problem occurs while writing to- out
- See Also:
- readTreeSet(java.io.DataInput)
 
 - 
readTreeSetpublic static <E> java.util.TreeSet<E> readTreeSet(java.io.DataInput in) throws java.io.IOException, java.lang.ClassNotFoundExceptionReads aTreeSetfrom aDataInput.- Type Parameters:
- E- the type contained in the- TreeSet
- Parameters:
- in- the- DataInputto read from
- Returns:
- the deserialized TreeSet
- Throws:
- java.io.IOException- A problem occurs while reading from- in
- java.lang.ClassNotFoundException- The class of one of the- TreeSet's elements cannot be found.
- See Also:
- writeTreeSet(java.util.TreeSet<?>, java.io.DataOutput)
 
 - 
writePropertiespublic static void writeProperties(java.util.Properties props, java.io.DataOutput out) throws java.io.IOExceptionWrites aPropertiesto aDataOutput.NOTE: The defaultsof the specifiedpropsare not serialized.Note that even though propsmay be an instance of a subclass ofProperties,readPropertieswill always return an instance ofProperties, not an instance of the subclass. To preserve the class type ofprops,writeObject(Object, DataOutput)should be used for data serialization.- Parameters:
- props- the Properties to write
- out- the- DataInputto write to
- Throws:
- java.io.IOException- A problem occurs while writing to- out
- See Also:
- readProperties(java.io.DataInput)
 
 - 
readPropertiespublic static java.util.Properties readProperties(java.io.DataInput in) throws java.io.IOException, java.lang.ClassNotFoundExceptionReads aPropertiesfrom aDataInput.NOTE: the defaultsare always empty in the returnedProperties.- Parameters:
- in- the- DataInputto read from
- Returns:
- the deserialized Properties
- Throws:
- java.io.IOException- If this serializer cannot read an object from- in.
- java.lang.ClassNotFoundException- If the class cannot be loaded
- See Also:
- writeProperties(java.util.Properties, java.io.DataOutput)
 
 - 
writeObjectpublic static void writeObject(java.lang.Object o, java.io.DataOutput out, boolean allowJavaSerialization) throws java.io.IOExceptionWrites an arbitrary object to aDataOutputby serializing it into bytes. Serialization is done with the following steps:- If oisnullthen GemFire serialize it. Note thatNullPointerExceptionis not thrown.
- If ois an instance ofDataSerializable.Replaceablethen callwriteObjectwith whatreplacereturns.
- If ois an instance ofPdxSerializablethen GemFire serialize it as PDX.
- If ois an instance ofDataSerializablethen GemFire serialize it as DataSerializable.
- If ois a GemFire instance ofPdxInstancethen GemFire serialize it as PDX.
- If ois a GemFire instance ofJsonDocumentthen GemFire serialize it.
- If ois an instance of the classes listed ongetSupportedClasses()then GemFire serialize it.
- If ois an instance of a class that has aDataSerializerregistered for it then GemFire serialize it.
- If a PdxSerializerhas been registered, and it acceptsothen GemFire serialize it. Note that this step includesReflectionBasedAutoSerializer.
- Otherwise if allowJavaSerializationis true, attempt standard Java serialization. Note that once standard Java serialization is used, then it will also be used for all the objects referenced byoeven if those objects would normally use GemFire serialization.
 - Parameters:
- o- the object to write
- out- the- DataOutputto write to
- allowJavaSerialization- If false, then a NotSerializableException is thrown in the case where standard Java serialization would otherwise be used for object- oor for any nested sub-object of- o. This is used to prevent Java serialization from being used when sending data to a non-Java client
- Throws:
- java.io.IOException- A problem occurs while writing- oto- out
- See Also:
- readObject(DataInput),- Instantiator,- ObjectOutputStream.writeObject(java.lang.Object)
 
- If 
 - 
writeObjectpublic static void writeObject(java.lang.Object o, java.io.DataOutput out) throws java.io.IOExceptionWrites an arbitrary object to aDataOutputby callingwriteObject(Object, DataOutput, boolean)withtrue.- Parameters:
- o- the object to write
- out- the- DataOutputto write to
- Throws:
- java.io.IOException- A problem occurs while writing- oto- out
- See Also:
- writeObject(Object, DataOutput, boolean)
 
 - 
readObjectpublic static <T> T readObject(java.io.DataInput in) throws java.io.IOException, java.lang.ClassNotFoundExceptionReads an arbitrary object from aDataInput. Instances of classes that are not handled specially (such asString,Class, andDataSerializable) are read using standard Java serialization.Note that if an object is deserialized using standard Java serialization, its class will be loaded using the current thread's context class loaderbefore the one normally used by Java serialization is consulted.- Type Parameters:
- T- the type of the Object to read
- Parameters:
- in- the- DataInputto read from
- Returns:
- an arbitrary deserialized object
- Throws:
- java.io.IOException- A problem occurred while reading from- in(may wrap another exception)
- java.lang.ClassNotFoundException- The class of an object read from- incould not be found
- See Also:
- writeObject(Object, DataOutput),- ObjectInputStream.readObject()
 
 - 
registerpublic static DataSerializer register(java.lang.Class<?> c) Registers aDataSerializerclass with the data serialization framework. This method uses reflection to create an instance of theDataSerializerclass by invoking its zero-argument constructor.The DataSerializerinstance will be consulted by thewriteObject(Object, DataOutput)andreadObject(java.io.DataInput)methods. Note that no two serializers can support the same class.This method invokes the DataSerializerinstance'sgetSupportedClasses()method and keeps track of which classes can have their instances serialized by by this data serializer.- Parameters:
- c- the- DataSerializerclass to create and register with the data serialization framework.
- Returns:
- the registered serializer instance
- Throws:
- java.lang.IllegalArgumentException- If- cdoes not subclass- DataSerializer, if- cdoes not have a zero-argument constructor, if- idis 0, if getSupportedClasses returns null or an empty array, if getSupportedClasses returns and array with null elements
- java.lang.IllegalStateException- if another serializer instance with id- idhas already been registered, if another serializer instance that supports one of this instances classes has already been registered, if an attempt is made to support any of the classes reserved by DataSerializer (see- getSupportedClasses()for a list).
- See Also:
- getSupportedClasses()
 
 - 
getSupportedClassespublic abstract java.lang.Class<?>[] getSupportedClasses() Returns theClasses whose instances are data serialized by thisDataSerializer. This method is invoked when this serializer is registered. This method is not allowed to returnnullnor an empty array. Only instances whose class name is the same as one of the class names in the result will be serialized by thisDataSerializer. TwoDataSerializers are not allowed to support the same class. The following classes can not be supported by user defined data serializers since they are all supported by the predefined data serializers:- Class
- String
- Boolean
- Byte
- Character
- Short
- Integer
- Long
- Float
- Double
- File
- BigInteger
- BigDecimal
- InetAddress
- Inet4Address
- Inet6Address
- Timestamp
- ArrayList
- Date
- HashMap
- IdentityHashMap
- HashSet
- Hashtable
- LinkedHashSet
- LinkedList
- Optional
- OptionalInt
- OptionalLong
- OptionalDouble
- Properties
- Stack
- TreeMap
- TreeSet
- UUID
- Vector
- any array classNote: an Object[], with the exception of String[], can be handled by a user defined DataSerializer
- any enum classNote: Enum classes other than java.util.concurrent.TimeUnit can be handled by a user defined DataSerializer
 - Returns:
- the Classes whose instances are data serialized by thisDataSerializer
 
 - 
toDatapublic abstract boolean toData(java.lang.Object o, java.io.DataOutput out) throws java.io.IOExceptionData serializes an object to aDataOutput. It is very important that when performing the "switch" ono's class, your code test for a subclass before it tests for a superclass. Otherwise, the incorrect class id could be written to the serialization stream.- Parameters:
- o- The object to data serialize. It will never be- null.
- out- the- DataInputto write to
- Returns:
- falseif this- DataSerializerdoes not know how to data serialize- o.
- Throws:
- java.io.IOException- If this serializer cannot write an object to- out.
 
 - 
fromDatapublic abstract java.lang.Object fromData(java.io.DataInput in) throws java.io.IOException, java.lang.ClassNotFoundExceptionReads an object from aDataInput. This implementation must support deserializing everything serialized by the matchingtoData(java.lang.Object, java.io.DataOutput).- Parameters:
- in- the- DataInputto write to
- Returns:
- the deserialized Object
- Throws:
- java.io.IOException- If this serializer cannot read an object from- in.
- java.lang.ClassNotFoundException- If the class cannot be loaded
- See Also:
- toData(java.lang.Object, java.io.DataOutput)
 
 - 
getIdpublic abstract int getId() Returns the id of thisDataSerializer.Returns an int instead of a byte - Returns:
- the id of this DataSerializer
- Since:
- 5.7.
 
 - 
equalspublic boolean equals(java.lang.Object o) TwoDataSerializers are consider to be equal if they have the same id and the same class- Overrides:
- equalsin class- java.lang.Object
 
 - 
hashCodepublic int hashCode() - Overrides:
- hashCodein class- java.lang.Object
 
 - 
setEventIdpublic void setEventId(java.lang.Object eventId) For internal use only. Sets the uniqueeventIdof thisDataSerializer.- Parameters:
- eventId- the unique- eventIdof this- DataSerializer
- Since:
- GemFire 6.5
 
 - 
getEventIdpublic java.lang.Object getEventId() For internal use only. Returns the uniqueeventIdof thisDataSerializer.- Returns:
- the unique eventIdof thisDataSerializer
- Since:
- GemFire 6.5
 
 - 
setContextpublic void setContext(java.lang.Object context) For internal use only. Sets the context of thisDataSerializer.- Parameters:
- context- the context of this- DataSerializer
- Since:
- GemFire 6.5
 
 - 
getContextpublic java.lang.Object getContext() For internal use only. Returns the context of thisDataSerializer.- Returns:
- the context of this DataSerializer
- Since:
- GemFire 6.5
 
 - 
writeEnumpublic static void writeEnum(java.lang.Enum<?> e, java.io.DataOutput out) throws java.io.IOExceptionWrites theEnum constanttoDataOutput. Unlike standard java serialization which serializes both the enum name String and the ordinal, GemFire only serializes the ordinal byte, so for backward compatibility new enum constants should only be added to the end of the enum type.
 Example:DataSerializer.writeEnum(DAY_OF_WEEK.SUN, out);- Parameters:
- e- the Enum to serialize
- out- the- DataInputto write to
- Throws:
- java.io.IOException- if a problem occurs while writing to- out
- Since:
- GemFire 6.5
- See Also:
- readEnum(Class, DataInput)
 
 - 
readEnumpublic static <E extends java.lang.Enum<E>> E readEnum(java.lang.Class<E> clazz, java.io.DataInput in) throws java.io.IOExceptionReads anEnum constantfromDataInput. Unlike standard java serialization which serializes both the enum name String and the ordinal, GemFire only serializes the ordinal byte, so be careful about using the correct enum class. Also, for backward compatibility new enum constants should only be added to the end of the enum type.
 Example:DAY_OF_WEEK d = DataSerializer.readEnum(DAY_OF_WEEK.class, in);- Type Parameters:
- E- the type of Enum
- Parameters:
- clazz- the Enum class to deserialize to
- in- the- DataInputto read from
- Returns:
- the deserialized Enum
- Throws:
- java.io.IOException- if a problem occurs while reading from- in
- java.lang.ArrayIndexOutOfBoundsException- if the wrong enum class/enum class with a different version and less enum constants is used
- Since:
- GemFire 6.5
- See Also:
- writeEnum(Enum, DataOutput)
 
 - 
writeOptionalpublic static <T> void writeOptional(java.util.Optional<T> o, java.io.DataOutput out) throws java.io.IOExceptionWrites anOptionalto aDataOutput.- Type Parameters:
- T- the type of value in the- Optional
- Parameters:
- o- the- Optionalto write
- out- the- DataOutputto write to
- Throws:
- java.io.IOException- A problem occurs while writing to- out
- java.lang.NullPointerException- if o is null
- Since:
- GemFire 10.1
- See Also:
- readOptional(java.io.DataInput)
 
 - 
readOptionalpublic static <T> java.util.Optional<T> readOptional(java.io.DataInput in) throws java.io.IOException, java.lang.ClassNotFoundExceptionReads anOptionalfrom aDataInput.- Type Parameters:
- T- – the type of value in the- Optional
- Parameters:
- in- the- DataInputto read from
- Returns:
- the deserialized Optional
- Throws:
- java.io.IOException- A problem occurs while reading from- in
- java.lang.ClassNotFoundException- The class of the- Optional's elements cannot be found.
- Since:
- GemFire 10.1
- See Also:
- writeOptional(java.util.Optional<T>, java.io.DataOutput)
 
 - 
writeOptionalIntpublic static void writeOptionalInt(java.util.OptionalInt o, java.io.DataOutput out) throws java.io.IOExceptionWrites anOptionalIntto aDataOutput.- Parameters:
- o- the- OptionalIntto write
- out- the- DataOutputto write to
- Throws:
- java.io.IOException- A problem occurs while writing to- out
- java.lang.NullPointerException- if o is null
- Since:
- GemFire 10.1
- See Also:
- readOptionalInt(java.io.DataInput)
 
 - 
readOptionalIntpublic static java.util.OptionalInt readOptionalInt(java.io.DataInput in) throws java.io.IOExceptionReads anOptionalIntfrom aDataInput.- Parameters:
- in- the- DataInputto read from
- Returns:
- the deserialized OptionalInt
- Throws:
- java.io.IOException- A problem occurs while reading from- in
- Since:
- GemFire 10.1
- See Also:
- writeOptionalInt(java.util.OptionalInt, java.io.DataOutput)
 
 - 
writeOptionalLongpublic static void writeOptionalLong(java.util.OptionalLong o, java.io.DataOutput out) throws java.io.IOExceptionWrites anOptionalLongto aDataOutput.- Parameters:
- o- the- OptionalLongto write
- out- the- DataOutputto write to
- Throws:
- java.io.IOException- A problem occurs while writing to- out
- java.lang.NullPointerException- if o is null
- Since:
- GemFire 10.1
- See Also:
- readOptionalLong(java.io.DataInput)
 
 - 
readOptionalLongpublic static java.util.OptionalLong readOptionalLong(java.io.DataInput in) throws java.io.IOExceptionReads anOptionalLongfrom aDataInput.- Parameters:
- in- the- DataInputto read from
- Returns:
- the deserialized OptionalLong
- Throws:
- java.io.IOException- A problem occurs while reading from- in
- Since:
- GemFire 10.1
- See Also:
- writeOptionalLong(java.util.OptionalLong, java.io.DataOutput)
 
 - 
writeOptionalDoublepublic static void writeOptionalDouble(java.util.OptionalDouble o, java.io.DataOutput out) throws java.io.IOExceptionWrites anOptionalDoubleto aDataOutput.- Parameters:
- o- the- OptionalDoubleto write
- out- the- DataOutputto write to
- Throws:
- java.io.IOException- A problem occurs while writing to- out
- java.lang.NullPointerException- if o is null
- Since:
- GemFire 10.1
- See Also:
- readOptionalDouble(java.io.DataInput)
 
 - 
readOptionalDoublepublic static java.util.OptionalDouble readOptionalDouble(java.io.DataInput in) throws java.io.IOExceptionReads anOptionalDoublefrom aDataInput.- Parameters:
- in- the- DataInputto read from
- Returns:
- the deserialized OptionalDouble
- Throws:
- java.io.IOException- A problem occurs while reading from- in
- Since:
- GemFire 10.1
- See Also:
- writeOptionalDouble(java.util.OptionalDouble, java.io.DataOutput)
 
 - 
readOptionalPrimitiveprotected static <T> T readOptionalPrimitive(java.io.DataInput in) throws java.io.IOException- Throws:
- java.io.IOException
 
 
- 
 
- 
