com.metamatrix.core.util
Class ExternalizeUtil

java.lang.Object
  extended by com.metamatrix.core.util.ExternalizeUtil

public class ExternalizeUtil
extends java.lang.Object

Utilities used by Externalizable classes to read/write objects from ObjectInput/ObjectOutput instances.


Method Summary
static java.util.List readList(java.io.ObjectInput in)
          Reads a List that was written by this utility class.
static java.util.Map readMap(java.io.ObjectInput in)
          Reads a Map that was written by this utility class
static java.lang.String[] readStringArray(java.io.ObjectInput in)
          Reads an array of String that was written to the ouput by this utility class
static java.lang.Throwable readThrowable(java.io.ObjectInput in)
           
static void writeArray(java.io.ObjectOutput out, java.lang.Object[] array)
          Writes an array to the output.
static void writeCollection(java.io.ObjectOutput out, java.util.Collection coll)
          Writes a Collection to the output using its Iterator.
static void writeList(java.io.ObjectOutput out, java.util.List list)
          Writes a List to the output using its indexes.
static void writeMap(java.io.ObjectOutput out, java.util.Map map)
          Writes the key-value pairs of the given map to the output.
static void writeThrowable(java.io.ObjectOutput out, java.lang.Throwable t)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

writeArray

public static void writeArray(java.io.ObjectOutput out,
                              java.lang.Object[] array)
                       throws java.io.IOException
Writes an array to the output.

Parameters:
out - the output instance
array - reference to an array. Can be null.
Throws:
java.io.IOException

writeCollection

public static void writeCollection(java.io.ObjectOutput out,
                                   java.util.Collection coll)
                            throws java.io.IOException
Writes a Collection to the output using its Iterator.

Parameters:
out - the output instance
coll - reference to a Collection. Can be null.
Throws:
java.io.IOException

writeList

public static void writeList(java.io.ObjectOutput out,
                             java.util.List list)
                      throws java.io.IOException
Writes a List to the output using its indexes.

Parameters:
out - the output instance
list - reference to a List. Can be null.
Throws:
java.io.IOException

writeMap

public static void writeMap(java.io.ObjectOutput out,
                            java.util.Map map)
                     throws java.io.IOException
Writes the key-value pairs of the given map to the output.

Parameters:
out - the output instance
list - reference to a Map. Can be null.
Throws:
java.io.IOException

readStringArray

public static java.lang.String[] readStringArray(java.io.ObjectInput in)
                                          throws java.io.IOException,
                                                 java.lang.ClassNotFoundException
Reads an array of String that was written to the ouput by this utility class

Parameters:
in -
Returns:
a non-null String[]
Throws:
java.io.IOException
java.lang.ClassNotFoundException

readList

public static java.util.List readList(java.io.ObjectInput in)
                               throws java.io.IOException,
                                      java.lang.ClassNotFoundException
Reads a List that was written by this utility class.

Parameters:
in -
Returns:
a non-null List
Throws:
java.io.IOException
java.lang.ClassNotFoundException

readMap

public static java.util.Map readMap(java.io.ObjectInput in)
                             throws java.io.IOException,
                                    java.lang.ClassNotFoundException
Reads a Map that was written by this utility class

Parameters:
in -
Returns:
a non-null Map
Throws:
java.io.IOException
java.lang.ClassNotFoundException

writeThrowable

public static void writeThrowable(java.io.ObjectOutput out,
                                  java.lang.Throwable t)
                           throws java.io.IOException
Throws:
java.io.IOException

readThrowable

public static java.lang.Throwable readThrowable(java.io.ObjectInput in)
                                         throws java.io.IOException,
                                                java.lang.ClassNotFoundException
Throws:
java.io.IOException
java.lang.ClassNotFoundException


Copyright © 2009. All Rights Reserved.