[jboss-cvs] JBossRemoting/src/main/org/jboss/remoting/marshal/serializable ...
Ron Sigal
ron_sigal at yahoo.com
Fri May 18 22:19:30 EDT 2007
User: rsigal
Date: 07/05/18 22:19:30
Modified: src/main/org/jboss/remoting/marshal/serializable Tag:
remoting_2_x SerializableUnMarshaller.java
Log:
JBREM-714: Added version parameter to read()/write().
Revision Changes Path
No revision
No revision
1.11.10.4 +29 -4 JBossRemoting/src/main/org/jboss/remoting/marshal/serializable/SerializableUnMarshaller.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: SerializableUnMarshaller.java
===================================================================
RCS file: /cvsroot/jboss/JBossRemoting/src/main/org/jboss/remoting/marshal/serializable/SerializableUnMarshaller.java,v
retrieving revision 1.11.10.3
retrieving revision 1.11.10.4
diff -u -b -r1.11.10.3 -r1.11.10.4
--- SerializableUnMarshaller.java 4 Feb 2007 08:47:31 -0000 1.11.10.3
+++ SerializableUnMarshaller.java 19 May 2007 02:19:30 -0000 1.11.10.4
@@ -28,8 +28,10 @@
import java.io.ObjectInputStream;
import java.util.Map;
+import org.jboss.remoting.Version;
import org.jboss.remoting.marshal.PreferredStreamUnMarshaller;
import org.jboss.remoting.marshal.UnMarshaller;
+import org.jboss.remoting.marshal.VersionedUnMarshaller;
import org.jboss.remoting.serialization.SerializationManager;
import org.jboss.remoting.serialization.SerializationStreamFactory;
@@ -38,7 +40,7 @@
*
* @author <a href="mailto:tom at jboss.org">Tom Elrod</a>
*/
-public class SerializableUnMarshaller implements PreferredStreamUnMarshaller
+public class SerializableUnMarshaller implements PreferredStreamUnMarshaller, VersionedUnMarshaller
{
static final long serialVersionUID = -1554017376768780738L;
@@ -91,8 +93,32 @@
*/
public Object read(InputStream inputStream, Map metadata) throws IOException, ClassNotFoundException
{
+ int version = Version.getDefaultVersion();
+ return read(inputStream, metadata, version);
+ }
+
+ /**
+ * Reads the data from the input stream and converts to an Object.
+ * <p/>
+ * If the inputStream passed is an ObjectInputStream (which would prefer it not be), it will just
+ * use it as given. If the input stream is not an instance of ObjectInputStream, will wrap it with a
+ * custom ObjectInputStream (ObjectInputStreamWithClassLoader) and use it. The ObjectInputStreamWithClassLoader
+ * will use the custom class loader set in order to ensure that any classes not found within the local classloader
+ * can be loaded from the server and used within the client VM. If the inpustream is of type ObjectInputStreamWithClassLoader,
+ * then will just set the classloader to the custom classloader and proceed.<p>
+ *
+ * @param inputStream
+ * @param metadata
+ * @param version
+ * @return
+ * @throws IOException
+ * @throws ClassNotFoundException
+ */
+ public Object read(InputStream inputStream, Map metadata, int version) throws IOException, ClassNotFoundException
+ {
ObjectInputStream ois = (ObjectInputStream) getMarshallingStream(inputStream, null);
- return SerializationStreamFactory.getManagerInstance(getSerializationType()).receiveObject(ois, customClassLoader);
+ return SerializationStreamFactory.getManagerInstance(getSerializationType()).receiveObject(ois, customClassLoader, version);
+
}
/**
@@ -130,5 +156,4 @@
return serializationType;
}
}
-
}
\ No newline at end of file
More information about the jboss-cvs-commits
mailing list