[jboss-cvs] JBossRemoting/src/main/org/jboss/remoting/marshal/serializable ...
Ron Sigal
ron_sigal at yahoo.com
Mon Jan 29 00:13:09 EST 2007
User: rsigal
Date: 07/01/29 00:13:09
Modified: src/main/org/jboss/remoting/marshal/serializable Tag:
remoting_2_x SerializableUnMarshaller.java
Log:
JBREM-692: Changed to implement interface PreferredStreamUnMarshaller.
Revision Changes Path
No revision
No revision
1.11.10.1 +31 -3 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
retrieving revision 1.11.10.1
diff -u -b -r1.11 -r1.11.10.1
--- SerializableUnMarshaller.java 30 Dec 2005 05:26:30 -0000 1.11
+++ SerializableUnMarshaller.java 29 Jan 2007 05:13:09 -0000 1.11.10.1
@@ -22,11 +22,16 @@
package org.jboss.remoting.marshal.serializable;
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
import java.io.IOException;
import java.io.InputStream;
+import java.io.ObjectInputStream;
import java.util.Map;
-import org.jboss.remoting.marshal.SerialUnMarshaller;
+
+import org.jboss.remoting.marshal.PreferredStreamUnMarshaller;
import org.jboss.remoting.marshal.UnMarshaller;
+import org.jboss.remoting.serialization.SerializationManager;
import org.jboss.remoting.serialization.SerializationStreamFactory;
/**
@@ -34,7 +39,7 @@
*
* @author <a href="mailto:tom at jboss.org">Tom Elrod</a>
*/
-public class SerializableUnMarshaller implements SerialUnMarshaller
+public class SerializableUnMarshaller implements PreferredStreamUnMarshaller
{
static final long serialVersionUID = -1554017376768780738L;
@@ -44,6 +49,26 @@
protected String serializationType;
+ public InputStream getMarshallingStream(InputStream inputStream) throws IOException
+ {
+ return getMarshallingStream(inputStream, null);
+ }
+
+ public InputStream getMarshallingStream(InputStream inputStream, Map config) throws IOException
+ {
+ if (inputStream instanceof ObjectInputStream)
+ {
+ return inputStream;
+ }
+ else
+ {
+ BufferedInputStream bis = new BufferedInputStream(inputStream);
+ SerializationManager manager = SerializationStreamFactory.getManagerInstance(getSerializationType());
+ return manager.createInput(bis, customClassLoader);
+ }
+
+ }
+
/**
* Reads the data from the input stream and converts to an Object.
@@ -63,7 +88,10 @@
*/
public Object read(InputStream inputStream, Map metadata) throws IOException, ClassNotFoundException
{
- return SerializationStreamFactory.getManagerInstance(getSerializationType()).receiveObject(inputStream, customClassLoader);
+ ObjectInputStream ois = (ObjectInputStream) getMarshallingStream(inputStream, null);
+// return ois.readObject();
+ return SerializationStreamFactory.getManagerInstance(getSerializationType()).receiveObject(ois, customClassLoader);
+
}
/**
More information about the jboss-cvs-commits
mailing list