CVS: Tapestry/framework/src/net/sf/tapestry/util/io ResolvingObjectInputStream.java,NONE,1.1.2.1 SerializableAdaptor.java,1.6,1.6.2.1

Howard Lewis Ship <[email protected]>
Newsgroups gmane.comp.java.tapestry.cvs
Message-ID <[email protected]>
Update of /cvsroot/tapestry/Tapestry/framework/src/net/sf/tapestry/util/io
In directory sc8-pr-cvs1:/tmp/cvs-serv7504/framework/src/net/sf/tapestry/util/io

Modified Files:
      Tag: hship-2-3
	SerializableAdaptor.java 
Added Files:
      Tag: hship-2-3
	ResolvingObjectInputStream.java 
Log Message:
Extract ResolvingObjectInputStream into a generally available class.

--- NEW FILE: ResolvingObjectInputStream.java ---
package net.sf.tapestry.util.io;

import java.io.*;

import net.sf.tapestry.IResourceResolver;

/**
 *  Specialized subclass of {@link java.io.ObjectInputStream}
 *  that knows how to resolve classes with a non-default
 *  class loader (represented by an instance of
 *  {@link net.sf.tapestry.IResourceResolver}).
 *
 *  @author Howard Lewis Ship
 *  @version $Id: ResolvingObjectInputStream.java,v 1.1.2.1 2003/01/02 03:02:25 hship Exp $
 *  @since 2.4
 *
 **/

public class ResolvingObjectInputStream extends ObjectInputStream
{
    private IResourceResolver _resolver;

    public ResolvingObjectInputStream(IResourceResolver resolver, InputStream input) throws IOException
    {
        super(input);

        _resolver = resolver;
    }

    /**
     *  Overrides the default implementation to
     *  have the resource resolver find the class.
     * 
     **/

    protected Class resolveClass(ObjectStreamClass v) throws IOException, ClassNotFoundException
    {
        return _resolver.findClass(v.getName());
    }
}
Index: SerializableAdaptor.java
===================================================================
RCS file: /cvsroot/tapestry/Tapestry/framework/src/net/sf/tapestry/util/io/SerializableAdaptor.java,v
retrieving revision 1.6
retrieving revision 1.6.2.1
diff -C2 -d -r1.6 -r1.6.2.1
*** SerializableAdaptor.java	27 Nov 2002 17:58:44 -0000	1.6
--- SerializableAdaptor.java	2 Jan 2003 03:02:25 -0000	1.6.2.1
***************
*** 34,66 ****
  class SerializableAdaptor implements ISqueezeAdaptor
  {
-     /**
-      *  Private class used for resolving classes when reading
-      *  a stream.
-      * 
-      **/
- 
-     private static class ResolvingObjectInputStream extends ObjectInputStream
-     {
-         private IResourceResolver _resolver;
- 
-         private ResolvingObjectInputStream(IResourceResolver resolver, InputStream input) throws IOException
-         {
-             super(input);
- 
-             _resolver = resolver;
-         }
- 
-         /**
-          *  Overrides the default implementation to
-          *  have the resource resolver find the class.
-          * 
-          **/
- 
-         protected Class resolveClass(ObjectStreamClass v) throws IOException, ClassNotFoundException
-         {
-             return _resolver.findClass(v.getName());
-         }
-     }
- 
      private static final String PREFIX = "O";
  
--- 34,37 ----



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.