Class FormatableArrayHolder
- java.lang.Object
-
- org.apache.derby.iapi.services.io.FormatableArrayHolder
-
- All Implemented Interfaces:
java.io.Externalizable
,java.io.Serializable
,Formatable
,TypedFormat
public class FormatableArrayHolder extends java.lang.Object implements Formatable
A formatable holder for an array of formatables. Used to avoid serializing arrays.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.Object[]
array
This class implements Formatable.
-
Constructor Summary
Constructors Constructor Description FormatableArrayHolder()
Niladic constructor for formatableFormatableArrayHolder(java.lang.Object[] array)
Construct a FormatableArrayHolder using the input array.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <E> E[]
getArray(java.lang.Class<E[]> arrayClass)
Get the held array of formatables, and return it in an array that is an instance ofarrayClass
.int
getTypeFormatId()
Get the formatID which corresponds to this class.void
readExternal(java.io.ObjectInput in)
Read this array from a stream of stored objects.void
setArray(java.lang.Object[] array)
Set the held array to the input array.void
writeExternal(java.io.ObjectOutput out)
Write this array out
-
-
-
Field Detail
-
array
private java.lang.Object[] array
This class implements Formatable. That means that it can write itself to and from a formatted stream. If you add more fields to this class, make sure that you also write/read them with the writeExternal()/readExternal() methods. If, inbetween releases, you add more fields to this class, then you should bump the version number emitted by the getTypeFormatId() method.
-
-
Method Detail
-
setArray
public void setArray(java.lang.Object[] array)
Set the held array to the input array.- Parameters:
array
- the array to hold
-
getArray
public <E> E[] getArray(java.lang.Class<E[]> arrayClass)
Get the held array of formatables, and return it in an array that is an instance ofarrayClass
.- Parameters:
arrayClass
- the type of array to return- Returns:
- an array of formatables
-
writeExternal
public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException
Write this array out- Specified by:
writeExternal
in interfacejava.io.Externalizable
- Parameters:
out
- write bytes here- Throws:
java.io.IOException
- thrown on error
-
readExternal
public void readExternal(java.io.ObjectInput in) throws java.io.IOException, java.lang.ClassNotFoundException
Read this array from a stream of stored objects.- Specified by:
readExternal
in interfacejava.io.Externalizable
- Parameters:
in
- read this.- Throws:
java.io.IOException
- thrown on errorjava.lang.ClassNotFoundException
- thrown on error
-
getTypeFormatId
public int getTypeFormatId()
Get the formatID which corresponds to this class.- Specified by:
getTypeFormatId
in interfaceTypedFormat
- Returns:
- the formatID of this class
-
-