Class FormatableArrayHolder

java.lang.Object
org.apache.derby.iapi.services.io.FormatableArrayHolder
All Implemented Interfaces:
Externalizable, Serializable, Formatable, TypedFormat

public class FormatableArrayHolder extends Object implements Formatable
A formatable holder for an array of formatables. Used to avoid serializing arrays.
See Also:
  • Field Details

    • array

      private 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.
  • Constructor Details

    • FormatableArrayHolder

      public FormatableArrayHolder()
      Niladic constructor for formatable
    • FormatableArrayHolder

      public FormatableArrayHolder(Object[] array)
      Construct a FormatableArrayHolder using the input array.
      Parameters:
      array - the array to hold
  • Method Details

    • setArray

      public void setArray(Object[] array)
      Set the held array to the input array.
      Parameters:
      array - the array to hold
    • getArray

      public <E> E[] getArray(Class<E[]> arrayClass)
      Get the held array of formatables, and return it in an array that is an instance of arrayClass.
      Parameters:
      arrayClass - the type of array to return
      Returns:
      an array of formatables
    • writeExternal

      public void writeExternal(ObjectOutput out) throws IOException
      Write this array out
      Specified by:
      writeExternal in interface Externalizable
      Parameters:
      out - write bytes here
      Throws:
      IOException - thrown on error
    • readExternal

      public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
      Read this array from a stream of stored objects.
      Specified by:
      readExternal in interface Externalizable
      Parameters:
      in - read this.
      Throws:
      IOException - thrown on error
      ClassNotFoundException - thrown on error
    • getTypeFormatId

      public int getTypeFormatId()
      Get the formatID which corresponds to this class.
      Specified by:
      getTypeFormatId in interface TypedFormat
      Returns:
      the formatID of this class