org.zkoss.io
Class Serializables

java.lang.Object
  extended by org.zkoss.io.Serializables

public class Serializables
extends java.lang.Object

Utilities to handle java.io.Serializable.

Author:
tomyeh

Method Summary
static java.util.Collection smartRead(java.io.ObjectInputStream s, java.util.Collection col)
          Reads serializable elements back (serialized by smartWrite(ObjectOutputStream,Collection))
static java.util.Map smartRead(java.io.ObjectInputStream s, java.util.Map map)
          Reads serializable entries back (serialized by smartWrite(ObjectOutputStream,Map)).
static void smartWrite(java.io.ObjectOutputStream s, java.util.Collection col)
          Writes only serializable elements of the specified collection.
static void smartWrite(java.io.ObjectOutputStream s, java.util.Map map)
          Writes only serializable entries of the specified map.
static void smartWrite(java.io.ObjectOutputStream s, java.lang.Object[] ary)
          Writes only serializable elements of the specified array.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

smartWrite

public static void smartWrite(java.io.ObjectOutputStream s,
                              java.util.Map map)
                       throws java.io.IOException
Writes only serializable entries of the specified map. Non-serializable attributes are ignored.

Throws:
java.io.IOException

smartRead

public static java.util.Map smartRead(java.io.ObjectInputStream s,
                                      java.util.Map map)
                               throws java.io.IOException,
                                      java.lang.ClassNotFoundException
Reads serializable entries back (serialized by smartWrite(ObjectOutputStream,Map)).

Parameters:
map - the map to hold the data being read. If null and any data is read, a new map (HashMap) is created and returned.
Returns:
the map being read
Throws:
java.io.IOException
java.lang.ClassNotFoundException

smartWrite

public static void smartWrite(java.io.ObjectOutputStream s,
                              java.util.Collection col)
                       throws java.io.IOException
Writes only serializable elements of the specified collection.

Throws:
java.io.IOException

smartRead

public static java.util.Collection smartRead(java.io.ObjectInputStream s,
                                             java.util.Collection col)
                                      throws java.io.IOException,
                                             java.lang.ClassNotFoundException
Reads serializable elements back (serialized by smartWrite(ObjectOutputStream,Collection))

Parameters:
col - the collection to hold the data beinig read. If null and and data is read, a new collection (LinkedList) is created and returned.
Returns:
the collection being read
Throws:
java.io.IOException
java.lang.ClassNotFoundException

smartWrite

public static void smartWrite(java.io.ObjectOutputStream s,
                              java.lang.Object[] ary)
                       throws java.io.IOException
Writes only serializable elements of the specified array.

To read back, use smartRead(ObjectInputStream, Collection).

Throws:
java.io.IOException
Since:
3.0.0


Copyright © 2005-2009 Potix Corporation. All Rights Reserved. SourceForge.net Logo