commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From scolebou...@apache.org
Subject svn commit: r241817 - /jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/input/ClassLoaderObjectInputStream.java
Date Sat, 27 Aug 2005 23:16:08 GMT
Author: scolebourne
Date: Sat Aug 27 16:16:02 2005
New Revision: 241817

URL: http://svn.apache.org/viewcvs?rev=241817&view=rev
Log:
Format class to IO coding standards for first release

Modified:
    jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/input/ClassLoaderObjectInputStream.java

Modified: jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/input/ClassLoaderObjectInputStream.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/input/ClassLoaderObjectInputStream.java?rev=241817&r1=241816&r2=241817&view=diff
==============================================================================
--- jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/input/ClassLoaderObjectInputStream.java
(original)
+++ jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/input/ClassLoaderObjectInputStream.java
Sat Aug 27 16:16:02 2005
@@ -1,5 +1,5 @@
 /*
- * Copyright 2001-2004 The Apache Software Foundation.
+ * Copyright 2001-2005 The Apache Software Foundation.
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -22,47 +22,47 @@
 import java.io.StreamCorruptedException;
 
 /**
- * A special ObjectInputStream to handle highly transient classes hosted
- * by Avalon components that are juggling many classloaders.
+ * A special ObjectInputStream that loads a class based on a specified
+ * <code>ClassLoader</code> rather than the system default.
+ * <p>
+ * This is useful in dynamic container environments.
  *
- * @author <a href="mailto:paul_hammant@yahoo.com">Paul Hammant</a>
- * @version $Revision$ $Date$
+ * @author Paul Hammant
+ * @version $Id$
+ * @since Commons IO 1.1
  */
-public class ClassLoaderObjectInputStream
-    extends ObjectInputStream
-{
-    private ClassLoader m_classLoader;
+public class ClassLoaderObjectInputStream extends ObjectInputStream {
+
+    /** The class loader to use. */
+    private ClassLoader classLoader;
 
     /**
      * Constructs a new ClassLoaderObjectInputStream.
-     * @param classLoader ClassLoader from which classes should be loaded.
-     * @param inputStream InputStream to work on
+     *
+     * @param classLoader  the ClassLoader from which classes should be loaded
+     * @param inputStream  the InputStream to work on
      * @throws IOException in case of an I/O error
      * @throws StreamCorruptedException if the stream is corrupted
      */
-    public ClassLoaderObjectInputStream( ClassLoader classLoader,
-                                         InputStream inputStream )
-        throws IOException, StreamCorruptedException
-    {
-        super( inputStream );
-        m_classLoader = classLoader;
+    public ClassLoaderObjectInputStream(
+            ClassLoader classLoader, InputStream inputStream)
+            throws IOException, StreamCorruptedException {
+        super(inputStream);
+        this.classLoader = classLoader;
     }
 
-    /** @see java.io.ObjectInputStream#resolveClass(java.io.ObjectStreamClass) */
-    protected Class resolveClass( ObjectStreamClass objectStreamClass )
-        throws IOException, ClassNotFoundException
-    {
-        Class clazz =
-            Class.forName( objectStreamClass.getName(), false, m_classLoader );
-
-        if( null != clazz )
-        {
-            return clazz; // the classloader knows of the class
-        }
-        else
-        {
+    /** @inheritDoc */
+    protected Class resolveClass(ObjectStreamClass objectStreamClass)
+            throws IOException, ClassNotFoundException {
+        
+        Class clazz = Class.forName(objectStreamClass.getName(), false, classLoader);
+
+        if (clazz != null) {
+            // the classloader knows of the class
+            return clazz;
+        } else {
             // classloader knows not of class, let the super classloader do it
-            return super.resolveClass( objectStreamClass );
+            return super.resolveClass(objectStreamClass);
         }
     }
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message